Werdox
Werdox
Explore posts from servers
PPrisma
Created by Werdox on 6/19/2024 in #help-and-questions
omit with condition
I want to only omit certain fields if a condition in the same thing I'm querying is true example:
const channels = await prisma.channel.findMany({
where: { ownerId: userId },
omit: { name: /* Only omit 'name' if the channel type is 1 */ },
});
const channels = await prisma.channel.findMany({
where: { ownerId: userId },
omit: { name: /* Only omit 'name' if the channel type is 1 */ },
});
11 replies
NNuxt
Created by Werdox on 4/18/2024 in #❓・help
Image Prerendering with Static build.
I'm using ipx and resizing my images but using nuxt generate does not prerender ipx images in the output folder and just copies the original images. I remember fixing this once but I don't remember how
1 replies
NNuxt
Created by Werdox on 3/30/2024 in #❓・help
load images from directory
How can I load all images from a directory in /public? I have a collage kind of page and want to load a ton of images but I don't want to manually type their name
1 replies
NNuxt
Created by Werdox on 3/30/2024 in #❓・help
Nuxt Image with ssr false
Im creating a portfolio website and it has a lot of small images inside. Im using NuxtImg component to set a size and quality for each image. Now local works perfectly fine but when I generate a static version, it uses does not optimize my images and just uses the original ones. I do have ssr: false in my config and image optimization does work when it's enabled.
4 replies
NNuxt
Created by Werdox on 3/17/2024 in #❓・help
page layout remounts when changing to a route using the same layout
I know this may be the intended behaviour but I'm creating a chat app and the layout has a list of user channels and it's not practical to fetch the whole list on every route change
2 replies
NNuxt
Created by Werdox on 2/17/2024 in #❓・help
Layout transition with javascript hook not working
I wanted to animate between layouts using anime.js. But it seems that the layout transition javascript hook doesn't even care about when the done() function is called and just immediately changes the layout. here is my code:
definePageMeta({
layout: "main",
layoutTransition: {
mode: "in-out",
onEnter(el, done) {
new Promise((resolve) => {
setTimeout(() => {
resolve(true);
}, 5000);
}).then(() => done());
},
},
});
definePageMeta({
layout: "main",
layoutTransition: {
mode: "in-out",
onEnter(el, done) {
new Promise((resolve) => {
setTimeout(() => {
resolve(true);
}, 5000);
}).then(() => done());
},
},
});
here I'm just creating a promise that when done, with call the done function. i tried to await it; tried using just setTimeout; nothing worked!
1 replies