engoyan
engoyan
NNuxt
Created by engoyan on 7/26/2024 in #❓・help
Nuxt Layers & dependencies
Hi David, Thanks for the PR! I was trying to figure out how to contact you about this, so I'm glad we're chatting. After struggling with the issue for a few days without success, I finally resolved it by making the following changes: 1. Reorganized the layer setup I had 2. Changed how the app includes layers 3. Switched from npm to pnpm I'm not entirely sure which of these fixes was the key to resolving the issue, but they all contributed to a working solution. It's possible that my problem wasn't related to the PR after all, although it did fix an extra Pinia package requirement. Some quick notes on what I've discovered:
I'm not able to register the stores automatically that the layer might define.
This worked fine without the code in your PR. I have a Pinia-ORM model defined in one layer and another in my app.
The stores directory in the layer gets lost when the containing app tries to register its own stores.
This issue was resolved out of the box as well. Initially, I had registered all the stores successfully, but components (pages) using app-level stores were losing reactivity. When there was an update in the state, the component wouldn't/didn't update the UI. With my new setup, this works fine now. If I had to take a guess, I'd say that my issue was related to Pinia being initialized in more than one place (layer + app), but I don't have any proof of that.
5 replies