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

fix: computed property write operation warning on just page component #802

Open
buglavecz opened this issue Sep 30, 2024 · 5 comments
Open
Assignees
Labels
bug Something isn't working

Comments

@buglavecz
Copy link

πŸ› The bug
I got this warning on just page component.
image

πŸ› οΈ To reproduce
Steps to reproduce the behavior:

If define a computed property like this (array manipulate: map, find, filter etc):

const myComputed = computed(() => {
    return [{ item: 'a' }, { item: 'b' }].map(item => item);
});

return { myComputed }

If not return in the setup() function, then not show the warning message....

ℹ️ Additional context
In the options API, that working fine.

@buglavecz buglavecz added the bug Something isn't working label Sep 30, 2024
@buglavecz
Copy link
Author

workaround:

const myComputed = computed({
    get() { return [{ item: 'a' }, { item: 'b' }].map(item => item); },
    set() {}
});

@danielroe
Copy link
Member

this is unlikely to be related to this library and is probably a Vue core issue.

@buglavecz
Copy link
Author

this is unlikely to be related to this library and is probably a Vue core issue.

@danielroe
the strange thing is that the error only occurs in nuxt page components. so I thought it had something to do with this package...

@danielroe
Copy link
Member

oh, that does sound more like it's an issue with nuxt

however vue 2 is EOL (and so is Nuxt 2) so unfortunately I am not planning to take time to look further into this. (apologies!) I hope the workaround you provided will serve you well. πŸ™

@buglavecz
Copy link
Author

@danielroe
okay, no problem. thanks your answer.

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

2 participants