Max Cahill
Max Cahill
NNuxt
Created by Max Cahill on 5/9/2024 in #❓・help
Layers: Knowing my layers
Hello friends! I am writing a little mono-repo multi-layered Nuxt3 project with Supabase. Doing so I already have few struggles I would like to address this wonderful community with: 1: Is there a way how to "manage" layers in runtime? (To give a the user a chance to turn the layer or/off)? My guess: Its not possible. 2: I would like every single layer to be able to register itself into application menu. That being said, it must be either able to perform certain operation (such as query the database) ONCE, when it was "used" (which seems impossible to me) OR I would need a way how to "loop" through all the layers I have in the project... Is there a way how to achieve this? 3: Can layers work with their "siblings" ? Example: I have a base layer - it extends layer UI and layer DB. Can I access layer DB from Layer UI without making layer UI extending layer DB? If I make (in this case) layer UI extend layer DB, wouldn't this "crash" the application due to DB layer being extended from base layer as well as from UI layer? 4: Namespacing - I know about this issue: https://github.com/nuxt/nuxt/issues/13367 - Named layers are about to come soon. But still I am interested in any advices or your experience, how do you guys distinguish between layers in code (preffixing components/composables/pages, ...)? 5: Store (i.e. Pinia): Do I understand it correctly it's a good practice to implement store (if possible) in the "lowest" module possible and then just use it in all sub-sequent layers? Any opinions are welcome here! Best regards, Max.
8 replies