fix: template query param stripped during login views (#6677)

Fixes issue where query params from
https://github.com/Comfy-Org/ComfyUI_frontend/pull/6593 are stripped
during the login/signup views/flow by storing initial params in session
storage via router plugin.



https://github.com/user-attachments/assets/51642e8c-af5c-43ef-ab7d-133bc7e511aa




┆Issue is synchronized with this [Notion
page](https://www.notion.so/PR-6677-fix-template-query-param-stripped-during-login-views-2aa6d73d365081a1bdc7d22b35f72a77)
by [Unito](https://www.unito.io)
This commit is contained in:
Christian Byrne
2025-11-13 20:37:37 -08:00
committed by GitHub
parent ecd87ae0f4
commit 8b8f3538bf
8 changed files with 262 additions and 3 deletions

View File

@@ -12,6 +12,10 @@ import { useTemplateUrlLoader } from '@/platform/workflow/templates/composables/
* - Input validation for template and source parameters
*/
const preservedQueryMocks = vi.hoisted(() => ({
clearPreservedQuery: vi.fn()
}))
// Mock vue-router
let mockQueryParams: Record<string, string | undefined> = {}
const mockRouterReplace = vi.fn()
@@ -25,6 +29,11 @@ vi.mock('vue-router', () => ({
}))
}))
vi.mock(
'@/platform/navigation/preservedQueryManager',
() => preservedQueryMocks
)
// Mock template workflows composable
const mockLoadTemplates = vi.fn().mockResolvedValue(true)
const mockLoadWorkflowTemplate = vi.fn().mockResolvedValue(true)
@@ -88,6 +97,7 @@ describe('useTemplateUrlLoader', () => {
'flux_simple',
'default'
)
expect(preservedQueryMocks.clearPreservedQuery).toHaveBeenCalledTimes(1)
})
it('uses default source when source param is not provided', async () => {