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

After upgrading to vuejs version 3.4, I see the message useComputedClass must be called within a component setup function. #10001

Closed
jschirrmacher opened this issue Jan 4, 2024 · 5 comments

Comments

@jschirrmacher
Copy link

Vue version

3.4.0 - 3.4.5

Link to minimal reproduction

https://github.com/homagix/homagix-frontend

Steps to reproduce

git clone https://github.com/jschirrmacher/homagix-frontend.git
npm i vue@3.4.5
npm run test:unit

What is expected?

Executing the unit tests should succeed.

What is actually happening?

When tests are run with vuejs 3.3.13, all works well.

After upgrading to vue 3.4.0 (or 3.4.5), I get an error message

useComputedClass must be called within a component setup function.

and before that a warning (which I don't know if that is related):

Vue warn]: Unhandled error during execution of scheduler flush. This is likely a Vue internals bug. Please open an issue at https://github.com/vuejs/core

Downgrading to vue 3.3.13 lets the tests succeed again, so it seems to be related to this release.

System Info

System:
    OS: macOS 13.6.3
    CPU: (4) x64 Intel(R) Core(TM) i7-7660U CPU @ 2.50GHz
    Memory: 236.71 MB / 8.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 18.12.1 - ~/.nodenv/versions/18.12.1/bin/node
    npm: 8.19.2 - ~/.nodenv/versions/18.12.1/bin/npm
  Browsers:
    Chrome: 120.0.6099.199
    Safari: 17.2.1
  npmPackages:
    vue: ^3.4.5 => 3.4.5

Any additional comments?

No response

@jschirrmacher
Copy link
Author

There is also a Stackoverflow question seeing this same error with other code.

What is in common is, that it also uses Oruga. Might be related to this as well.

@baiwusanyu-c
Copy link
Member

baiwusanyu-c commented Jan 5, 2024

This is the reason for oruga.
I noticed that they used useComputedClass extensively in compute. v3.4 has made enhancements in the reactivity system, which may have caused this problem.
oruga-ui/oruga#709

I followed the writing method of oruga. There is no recurrence problem in the playground. You may need to provide a repository that can reproduce the problem.

@baiwusanyu-c
Copy link
Member

relate:#9974

@modelair
Copy link

modelair commented Jan 7, 2024

this is related to oruga, not vue. author must fix his library use-hooks

@yyx990803
Copy link
Member

I've added a warning if getCurrentInstance() is called inside a computed getter in 324e817

The usage is incorrect and should be fixed in oruga.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants