Kérunix
Kérunix
NNuxt
Created by AerodynamicPotato on 9/30/2024 in #❓・help
`useAsyncData` - onSuccess callback?
Not really cleaner but I used the transform option to perform side effects when the request succeeds before returning the same data.
2 replies
NNuxt
Created by Domme on 9/20/2024 in #❓・help
Request data in a plugin before sending the files to the client
You can suffix your file with .server to make the plugin only run on the server side during the initial SSR request. Something like my-plugin.server.ts
2 replies
NNuxt
Created by Aleksandar Brkić on 5/27/2024 in #❓・help
Unknown order of nested routes
I believe the best way to handle such a problem would be using query params instead of actual route parameters like this: /index?time=[7,15]&latitude=[40,50] or /index?latitude=[40,50]&longitude=[20,30]&time=[15,23]. These allow any order and can be optionnal, while still rendering a single page that can bind to the query using useRoute() so you can read and manipulate them based on your filters.
7 replies
NNuxt
Created by djenntt on 5/20/2024 in #❓・help
Auto-imports VS Code
Hey there ! Have you tried running npx nuxi dev or npx nuxi prepare ? Nuxt generates a lot of types and auto imports when buidling the dev server and those are not available to your IDE until then.
3 replies
NNuxt
Created by narr07 on 5/21/2024 in #❓・help
How to make a CodeGroup like on Nuxt UI Pro,
I guess you could use headless ui's tab component for the layout and shiki for the syntx highlighting.
2 replies
NNuxt
Created by vetekrans on 5/15/2024 in #❓・help
"router-link-active" not added when on sub route
I'm not sure of the correct answer here since the formatting of your message might mislead me (maybe navigate to your pages directory and show us the output of tree so we can understand how your pages are organised). But if the formating is correct in your post, then categories.vue and /categories should be on the same level as /posts/index.vue for Vue Router to set the correct classes.
4 replies
NNuxt
Created by elementare on 5/15/2024 in #❓・help
How can I ntegrate markdown with latex?
You can probably use KateX which is a JS rendering engine for LaTeX expressions. I nerver used it myself in markdown but I know Slidev uses it inside markdown files to render slides so you might want to take a look at their implementation.
2 replies
NNuxt
Created by Natetronn on 5/6/2024 in #❓・help
Nuxt i18n module v-html xss warning
Well technically there is an alternative but that is only useful if you want to interpolate some html content in a string that lives in your translations files. The example they give in the docs with an anchor tag inserted in some text is exactly the kind of use case for that feature. If your content is only html then v-html with trusted content is the way to go
8 replies
NNuxt
Created by Denoic on 5/5/2024 in #❓・help
State managment
Hey there. I'd say you don't have to use one over the other. The two are really for different use cases. If you want simple, small, SSR safe and reactive state (something like a simple array of user notifications, or a cookie value), you can stick to useState. But as soon as you start doing something like useMyState that derives values from your simple state (i.e. computed properties based on state), or that handles manipulating deeply nested state objects, that's when I'd go for Pinia which is really tailored for that sort of things. Note that if you really don't want to use Pinia you can still use composables and make your own reactive state management using only useState but at this point you'd be reinventing the wheel that Pinia made for us 🙂
3 replies
NNuxt
Created by Natetronn on 5/6/2024 in #❓・help
Nuxt i18n module v-html xss warning
The XSS warning is here just as, well, a warning. It signals you that you are injecting raw HTML into your page, which can lead to an XSS attack if the content comes from an untrusted source (ie. user generated content). If you are the one generating the content (from a CMS or even by storing raw html strings in a DB), this should not be an issue. As stated in the docs, "Only use HTML interpolation on trusted content and never on user-provided content." and "If the message contains HTML, Vue I18n outputs a warning to console when development mode" so this warning won't be logged in production.
8 replies
NNuxt
Created by Kérunix on 4/12/2024 in #❓・help
How to have a different "default" page in nested routing
Neither did I and its quite nice !
12 replies
NNuxt
Created by Kérunix on 4/12/2024 in #❓・help
How to have a different "default" page in nested routing
Yeah that did it, can't believe I didn't think of it. Thanks a lot for the help !
12 replies
NNuxt
Created by Kérunix on 4/12/2024 in #❓・help
How to have a different "default" page in nested routing
Ooooh that might work
12 replies
NNuxt
Created by Kérunix on 4/12/2024 in #❓・help
How to have a different "default" page in nested routing
Yeah I tried that already, didn't work 😅 (I had no doubt it woudln't, since navigateToLocalePath is working as intended in other middlewares in the same application)
12 replies
NNuxt
Created by Kérunix on 3/8/2023 in #❓・help
Fetching related data sequentially
This works fine no problem, the issue I have is for fetching the "secondary" data, I need to know which posts I get before I fetch their authors, and this can be achieved through a watcher but can become cumbersome if there's a lot of nested relations to fetch like user > comments > posts > authors for example. The solution from Woutercouvaras looks more like something that would work for me, chaining promises to fetch all the nested data based on an array of urls.
13 replies
NNuxt
Created by Kérunix on 3/8/2023 in #❓・help
Fetching related data sequentially
Sounds like a good start towards what I want, I'll have to make some changes to meet my business requirements but I think it could work thanks
13 replies