Skip to content

Using Vue 3 in Chrome extension bug #3423

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

Closed
kospl opened this issue Mar 15, 2021 · 3 comments
Closed

Using Vue 3 in Chrome extension bug #3423

kospl opened this issue Mar 15, 2021 · 3 comments
Labels
need more info Further information is requested

Comments

@kospl
Copy link

kospl commented Mar 15, 2021

Version

3.0.7

Reproduction link

https://github.com/kospl/demo-vue-3-chrome-extension-issue

Steps to reproduce

Follow readme steps at https://github.com/kospl/demo-vue-3-chrome-extension-issue/tree/main#readme

What is expected?

Console showing logs (no errors).

What is actually happening?

Error in console: Error handling response: TypeError: obj.error_info.errors.filter is not a function.


I know it is a bug related not just to Vue, but to Chrome extensions, but I think as a lot of developers use Vue, it worth to be logged to be aware of this issue while migrating to Vue 3.

@LinusBorg
Copy link
Member

I know it is a bug related not just to Vue, but to Chrome extensions

Can you provide more details? You say this is a general bug in chrome.storage? Then we can't really do anything about this ...

@LinusBorg LinusBorg added the need more info Further information is requested label Mar 15, 2021
@kospl
Copy link
Author

kospl commented Mar 15, 2021

@LinusBorg this was working with Vue 2 without an issue. While updating to Vue 3 it happened to not save array data correctly. I am not aware for exact reason, this might be too deep to investigate for me personally.

From provided demo it's easy to scope the issue to Vue / Proxy and Chrome storage API, but I am not sure which one of these three is a reason for data saved incorrectly, probably the combination Chrome APIs + Proxy is just wrong, or Chrome APIs + Vue's Proxy implementation.

I am still trying to find workaround, as deep copying method before saving seems has no effect.

@LinusBorg
Copy link
Member

toRaw() can give you the non-proxy original data, you should probably save that to storage instead.

chrome.storage.local.set({ error_info: Vue.toRaw(this.error_info) }, function(){

Might be worth documenting.

@kospl kospl closed this as completed Mar 16, 2021
@github-actions github-actions bot locked and limited conversation to collaborators Oct 24, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
need more info Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants