cosbgn
cosbgn
Explore posts from servers
NNuxt
Created by cosbgn on 9/21/2024 in #❓・help
How would you store a ref of an external packages in a state (useState)
But it's definitely only needed client side if that simplifies things
7 replies
NNuxt
Created by cosbgn on 9/21/2024 in #❓・help
How would you store a ref of an external packages in a state (useState)
@manniL / TheAlexLichter
7 replies
NNuxt
Created by cosbgn on 9/21/2024 in #❓・help
How would you store a ref of an external packages in a state (useState)
Currently I do:
const { chat_messages } = useSharedStore()
onBeforeUnmount(() => {
chat_messages.value = messages
})
onBeforeMount(() => {
messages.value = chat_messages.value
})

const { chat_messages } = useSharedStore()
onBeforeUnmount(() => {
chat_messages.value = messages
})
onBeforeMount(() => {
messages.value = chat_messages.value
})

But I should do it manually for each item and it's not ideal to keep all duplicated and synced. Ideally I would just have the messages directly in a store
7 replies
NNuxt
Created by cosbgn on 9/21/2024 in #❓・help
How would you store a ref of an external packages in a state (useState)
Not really, I only want the chat messages / methods etc available across multiple pages/components
7 replies
NNuxt
Created by cosbgn on 7/4/2024 in #❓・help
Is there an easy way to get `event`?
I don't think bindings would be available in useRuntimeConfig() no? That's some cloudflare specific thing, not normal env variables (they come from pi0/nitro-cloudflare-dev)
8 replies
NNuxt
Created by cosbgn on 7/4/2024 in #❓・help
Is there an easy way to get `event`?
Well originally I used event as event.context.cloudflare.env.DB but now I found an alternative without event (using environment variables)
8 replies
NNuxt
Created by cosbgn on 5/24/2024 in #❓・help
get `event` in `/utils/db.js` - Can I be done?
Found it:
const binding = process?.env?.DB || globalThis?.__env__?.DB || globalThis?.DB
const db = drizzle(binding, { schema: schema_file })
const binding = process?.env?.DB || globalThis?.__env__?.DB || globalThis?.DB
const db = drizzle(binding, { schema: schema_file })
2 replies
NNuxt
Created by cosbgn on 7/4/2024 in #❓・help
Is there an easy way to get `event`?
Found it!
const binding = process?.env?.DB || globalThis?.__env__?.DB || globalThis?.DB
const db = drizzle(binding, { schema: schema_file })
const binding = process?.env?.DB || globalThis?.__env__?.DB || globalThis?.DB
const db = drizzle(binding, { schema: schema_file })
8 replies
NNuxt
Created by cosbgn on 6/1/2024 in #❓・help
Props based on route generate hydration missmatch
Amazing, thanks
8 replies
NNuxt
Created by cosbgn on 6/1/2024 in #❓・help
Props based on route generate hydration missmatch
I'll need to rethink this step
8 replies
NNuxt
Created by cosbgn on 6/1/2024 in #❓・help
Props based on route generate hydration missmatch
The issue is that the component needs to v-model the json so I do:
onBeforeMount(() => columns.value = props?.config?.columns)
onBeforeMount(() => columns.value = props?.config?.columns)
Which is probably what causes the issue
8 replies
NNuxt
Created by cosbgn on 1/19/2024 in #❓・help
Do I need to use "lazy" with `useFetch/useAsyncData` when deploying to vercel?
Amazing. Thanks a lot!
13 replies
NNuxt
Created by cosbgn on 1/19/2024 in #❓・help
Do I need to use "lazy" with `useFetch/useAsyncData` when deploying to vercel?
(I'm not using any specific route rules, just deploy to vercel/cloudflare_pages) as it is
13 replies
NNuxt
Created by cosbgn on 1/19/2024 in #❓・help
Do I need to use "lazy" with `useFetch/useAsyncData` when deploying to vercel?
But say I have a page /account which displays different data for each user (depending on a httpOnly cookie) - Will that be generated at built time and display the same data to all users?
13 replies
NNuxt
Created by cosbgn on 1/19/2024 in #❓・help
Do I need to use "lazy" with `useFetch/useAsyncData` when deploying to vercel?
so unless I have a specific reason (e.g. I need localStorage) I should never user server:false, right?
13 replies
NNuxt
Created by cosbgn on 1/19/2024 in #❓・help
Do I need to use "lazy" with `useFetch/useAsyncData` when deploying to vercel?
Yeah, actually I think I meant server:false (not lazy)
13 replies
NNuxt
Created by cosbgn on 1/19/2024 in #❓・help
Do I need to use "lazy" with `useFetch/useAsyncData` when deploying to vercel?
Pretty much:
I should never use lazy with useFetch unless I have a value like api key / username etc in localstorage?
I should never use lazy with useFetch unless I have a value like api key / username etc in localstorage?
Right?
13 replies
NNuxt
Created by cosbgn on 1/19/2024 in #❓・help
Do I need to use "lazy" with `useFetch/useAsyncData` when deploying to vercel?
@danielroe sorry to tag you, but I've been trying to understand this for month, and I think you know it super well! 🙂
13 replies
NNuxt
Created by cosbgn on 1/19/2024 in #❓・help
Do I need to use "lazy" with `useFetch/useAsyncData` when deploying to vercel?
From my undertanding, before I was using nuxt/auth (v2) which used localStorage, so I had to always "wait for the client" But now I use auth-utils, which uses cookies, which are available server side, so I don't need to ever use lazy, right?
13 replies
NNuxt
Created by cosbgn on 8/12/2023 in #❓・help
Use wrangler as a dev server in localhost
Great thanks!
5 replies