-
-
Notifications
You must be signed in to change notification settings - Fork 5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(nuxt): change the name of the RouteProvider componet when keepalive #28203
base: main
Are you sure you want to change the base?
Conversation
Run & review this pull request in StackBlitz Codeflow. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you! This looks good to me. But would you have a look at the failing tests, and add a test to cover these changes, perhaps?
Lines 2511 to 2592 in eb31abe
describe('keepalive', () => { | |
it('should not keepalive by default', async () => { | |
const { page, consoleLogs } = await renderPage('/keepalive') | |
const pageName = 'not-keepalive' | |
await page.click(`#${pageName}`) | |
await page.waitForFunction(path => window.useNuxtApp?.()._route.fullPath === path, `/keepalive/${pageName}`) | |
expect(consoleLogs.map(l => l.text).filter(t => t.includes('keepalive'))).toEqual([`${pageName}: onMounted`]) | |
await page.close() | |
}) | |
it('should not keepalive when included in app config but config in nuxt-page is not undefined', async () => { | |
const { page, consoleLogs } = await renderPage('/keepalive') | |
const pageName = 'keepalive-in-config' | |
await page.click(`#${pageName}`) | |
await page.waitForFunction(path => window.useNuxtApp?.()._route.fullPath === path, `/keepalive/${pageName}`) | |
expect(consoleLogs.map(l => l.text).filter(t => t.includes('keepalive'))).toEqual([`${pageName}: onMounted`]) | |
await page.close() | |
}) | |
it('should not keepalive when included in app config but exclueded in nuxt-page', async () => { | |
const { page, consoleLogs } = await renderPage('/keepalive') | |
const pageName = 'not-keepalive-in-nuxtpage' | |
await page.click(`#${pageName}`) | |
await page.waitForFunction(path => window.useNuxtApp?.()._route.fullPath === path, `/keepalive/${pageName}`) | |
expect(consoleLogs.map(l => l.text).filter(t => t.includes('keepalive'))).toEqual([`${pageName}: onMounted`]) | |
await page.close() | |
}) | |
it('should keepalive when included in nuxt-page', async () => { | |
const { page, consoleLogs } = await renderPage('/keepalive') | |
const pageName = 'keepalive-in-nuxtpage' | |
await page.click(`#${pageName}`) | |
await page.waitForFunction(path => window.useNuxtApp?.()._route.fullPath === path, `/keepalive/${pageName}`) | |
expect(consoleLogs.map(l => l.text).filter(t => t.includes('keepalive'))).toEqual([`${pageName}: onMounted`, `${pageName}: onActivated`]) | |
await page.close() | |
}) | |
it('should preserve keepalive config when navigate routes in nuxt-page', async () => { | |
const { page, consoleLogs } = await renderPage('/keepalive') | |
const slugs = [ | |
'keepalive-in-nuxtpage', | |
'keepalive-in-nuxtpage-2', | |
'keepalive-in-nuxtpage', | |
'not-keepalive', | |
'keepalive-in-nuxtpage-2', | |
] | |
for (const slug of slugs) { | |
await page.click(`#${slug}`) | |
await page.waitForFunction(path => window.useNuxtApp?.()._route.fullPath === path, `/keepalive/${slug}`) | |
} | |
expect(consoleLogs.map(l => l.text).filter(t => t.includes('keepalive'))).toEqual([ | |
'keepalive-in-nuxtpage: onMounted', | |
'keepalive-in-nuxtpage: onActivated', | |
'keepalive-in-nuxtpage: onDeactivated', | |
'keepalive-in-nuxtpage-2: onMounted', | |
'keepalive-in-nuxtpage-2: onActivated', | |
'keepalive-in-nuxtpage: onActivated', | |
'keepalive-in-nuxtpage-2: onDeactivated', | |
'keepalive-in-nuxtpage: onDeactivated', | |
'not-keepalive: onMounted', | |
'keepalive-in-nuxtpage-2: onActivated', | |
'not-keepalive: onUnmounted', | |
]) | |
await page.close() | |
}) | |
}) |
@danielroe thanks for the quick reply. when I run |
Try running: pnpm playwright-core install chromium |
@danielroe thanks! it works. I have no idea how to fix it. Could you give me some ideas? |
I'd have a better idea of how to fix if you could provide a reproduction of the issue. |
how to fix it. |
🔗 Linked issue
keepalive include Bug
📚 Description
now, I can not dynamic control keepalive by change include config