dwol
dwol
NNuxt
Created by Timothy Yin on 10/14/2024 in #❓・help
How to prerender Nuxt Content when ssr is disabled?
The only way I’ve found to reliably do this is with setting ssr to true. You can still run generate with ssr: true. There’s also the experimental/ client build config option but it doesn’t seem very reliable for me.
3 replies
NNuxt
Created by eym on 10/13/2024 in #❓・help
using ref alongside conditional rendering (useTemplateRef + v-if)
Are you sure the verify mobile component is mounted when you try running the start countdown function? You might need to ‘await nextTick()’ or use a setTimeout
3 replies
NNuxt
Created by jovan on 10/8/2024 in #❓・help
@nuxtjs/i18n test errors
Glad you got it working!
19 replies
NNuxt
Created by jovan on 10/8/2024 in #❓・help
@nuxtjs/i18n test errors
I’m not at a computer right now so it’s not easy to link stuff but if you lookup ‘setup files’ for the vitest config you should be able to set it up for every test.
19 replies
NNuxt
Created by jovan on 10/8/2024 in #❓・help
@nuxtjs/i18n test errors
Ex: instead of testing AppSettings try creating and testing a basic component like a HelloWorld or something like that
19 replies
NNuxt
Created by jovan on 10/8/2024 in #❓・help
@nuxtjs/i18n test errors
I would try creating a test with a simple component to see if it’s something else causing the issue.
19 replies
NNuxt
Created by jovan on 10/8/2024 in #❓・help
@nuxtjs/i18n test errors
Yes using createI18n from vue is correct. I’m using this in my projects.
19 replies
NNuxt
Created by jovan on 10/8/2024 in #❓・help
@nuxtjs/i18n test errors
Sorry for the formatting, I’m on mobile.
19 replies
NNuxt
Created by jovan on 10/8/2024 in #❓・help
@nuxtjs/i18n test errors
You need to create an i18n plugin for your tests. I have a mocks/i18n.ts import { createI18n } from 'vue-i18n' import en from '~/locales/en-CA' import fr from '~/locales/fr-CA' export const enI18n = createI18n({ legacy: false, locale: 'en-CA', messages: { 'en-CA': en } }) export const frI18n = createI18n({ legacy: false, locale: 'fr-CA', messages: { 'fr-CA': fr } }) export const randomI18n = createI18n({ legacy: false, locale: 'ja', messages: { ja: en } }) Then import your i18n mock and use in your component: const wrapper = await mountSuspended(MyComponent, { global: { plugins: [enI18n] } })
19 replies
NNuxt
Created by Stefan on 10/7/2024 in #❓・help
nuxt3 with nuxtUI Failed to resolve component UPage
UPage is a pro component, do you have nuxt ui pro? If not then you won’t be able to use this component.
2 replies
NNuxt
Created by souf on 9/27/2024 in #❓・help
NuxtLoadingIndicator
I'm not sure if/how you can trigger it manually but in the docs for it theres a link to the composable they use to control it, I would start there.
5 replies
NNuxt
Created by CorrM on 9/26/2024 in #❓・help
Get `statusMessage` from $fetch
import { FetchError } from 'ofetch'
export function logFetchError (error: unknown, message: string) {
if (error instanceof FetchError) {
const e = error as FetchError
const status = e.response?.status ?? 'Unknown Status'
const statusText = e.response?.statusText ?? 'Unknown Status Text'
const hasMessage = e.data?.message !== undefined

console.error(`${message}: ${status} - ${statusText} ${hasMessage ? `--- ${JSON.stringify(e.data)}` : ''}`)
} else {
console.error(message)
}
}
import { FetchError } from 'ofetch'
export function logFetchError (error: unknown, message: string) {
if (error instanceof FetchError) {
const e = error as FetchError
const status = e.response?.status ?? 'Unknown Status'
const statusText = e.response?.statusText ?? 'Unknown Status Text'
const hasMessage = e.data?.message !== undefined

console.error(`${message}: ${status} - ${statusText} ${hasMessage ? `--- ${JSON.stringify(e.data)}` : ''}`)
} else {
console.error(message)
}
}
4 replies
NNuxt
Created by dmarr on 9/25/2024 in #❓・help
How to test the side effect of a watcher function?
you can change the timeout to whatever would be more appropriate for you, in this case it's a debounced watcher
6 replies
NNuxt
Created by dmarr on 9/25/2024 in #❓・help
How to test the side effect of a watcher function?
This is the only way I got my assertions to work when testing a watcher
await new Promise<void>((resolve) => {
setTimeout(() => {
expect(...assertions here)
resolve()
}, 1000)
await new Promise<void>((resolve) => {
setTimeout(() => {
expect(...assertions here)
resolve()
}, 1000)
6 replies
NNuxt
Created by Patrity on 9/13/2024 in #❓・help
Not fetching Supabase data
Did you try just returning the supabase call instead of destructing it and returning the data
20 replies
NNuxt
Created by Patrity on 9/13/2024 in #❓・help
Not fetching Supabase data
‘await useAsyncData’ ‘return supabase.from…’
20 replies
NNuxt
Created by Patrity on 9/13/2024 in #❓・help
Not fetching Supabase data
You aren’t returning anything or using await https://nuxt.com/docs/api/composables/use-async-data
20 replies
NNuxt
Created by Yannik on 9/9/2024 in #❓・help
Nuxt Content Markdown gets only rendered with server side rendering
The only way I've reliably gotten this to work is by setting ssr true and generating it that way. You can still generate the static site with ssr true. The only thing with this that is annoying is you may have to deal with hydration errors.
2 replies
NNuxt
Created by dwol on 9/4/2024 in #❓・help
How to spy on store functions during Pinia store test?
bump
2 replies
NNuxt
Created by kora on 8/29/2024 in #❓・help
does anyone have any idea why the form won't send?
try @submit"() => console.log('cc)"
7 replies