Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐛 Bug - [Vue warn]: Error in v-on handler: "TypeError: Cannot read properties of null (reading 'options')" #78

Closed
TooColline opened this issue Jun 1, 2023 · 8 comments
Labels
bug Something isn't working

Comments

@TooColline
Copy link

@google-translate-select bug report

I sometimes get this error when I click on a dropdown language option. This only happens after I navigate away from the page the component is mounted on and when I switch back to the page and try again it doesn't work. I assume the component options aren't ready yet by the rime it's mounted?

Summary

Environment

Using Vue 2.7

Steps to reproduce

Expected results

To switch to the language clicked on the dropdown

Actual results

The language switch doesn't work because of this error

@TooColline TooColline added the bug Something isn't working label Jun 1, 2023
@ubercj
Copy link
Contributor

ubercj commented Jun 2, 2023

I'm also encountering this bug using Vue 3 and Nuxt. It looks like the hidden Google Translate select element isn't getting reinjected in the DOM in between page loads. Instead, the '.goog-te-combo' is null, so it doesn't have any options

Screenshot 2023-06-02 at 4 14 24 PM Screenshot 2023-06-02 at 4 18 47 PM

It looks like the select element gets injected from a script tag inserted into the document head at runtime. Between page loads in a SPA, though, that script tag stays in the document head with the data-loaded attribute, so the script isn't being re-run

@TooColline
Copy link
Author

I'm also encountering this bug using Vue 3 and Nuxt. It looks like the hidden Google Translate select element isn't getting reinjected in the DOM in between page loads. Instead, the '.goog-te-combo' is null, so it doesn't have any options

Screenshot 2023-06-02 at 4 14 24 PM Screenshot 2023-06-02 at 4 18 47 PM
It looks like the select element gets injected from a script tag inserted into the document head at runtime. Between page loads in a SPA, though, that script tag stays in the document head with the data-loaded attribute, so the script isn't being re-run

Yeah, I think so too, we need a way to re-load the script, any ideas @i7eo of how we can fix this?

@i7eo
Copy link
Owner

i7eo commented Jun 20, 2023

Sorry guys, I've been very busy lately. I checked @ubercj pr and there is no problem, it has been merged

@i7eo i7eo closed this as completed Jun 20, 2023
@i7eo
Copy link
Owner

i7eo commented Jun 20, 2023

You can check version 0.1.2, Thanks @ubercj 👏

@HozSensei
Copy link

Hello there !
Thanks for your work :)

I use version 0.1.2 with vue3 but i still have this problem in my project
image

Just to be sure, i need to import the component like this :
image

@TooColline
Copy link
Author

Yeah it's still there for Vue2 as well, I think I had mentioned it before somewhere cc @ubercj

@HozSensei
Copy link

@i7eo, possible to re-open this bug? Or should we create a new one?

huazhuangnan added a commit to huazhuangnan/google-translate-select that referenced this issue Nov 3, 2023
fix react project options is not find
i7eo#78
@i7eo
Copy link
Owner

i7eo commented Nov 16, 2023

@i7eo, possible to re-open this bug? Or should we create a new one?

try @google-translate-select/vue2^0.1.3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants