mirror of
https://github.com/stablyai/orca.git
synced 2026-10-20 00:03:45 +00:00
fix(mobile): encode cold task host route
This commit is contained in:
@@ -1,6 +1,10 @@
|
||||
import { describe, expect, it, vi } from 'vitest'
|
||||
import { afterEach, describe, expect, it, vi } from 'vitest'
|
||||
import { mobileTasksRoute, navigateToMobileTasks } from './mobile-task-navigation'
|
||||
|
||||
afterEach(() => {
|
||||
vi.unstubAllGlobals()
|
||||
})
|
||||
|
||||
describe('mobileTasksRoute', () => {
|
||||
it('builds a concrete encoded host route', () => {
|
||||
expect(mobileTasksRoute('host/1')).toBe('/h/host%2F1/tasks')
|
||||
@@ -16,12 +20,11 @@ describe('mobileTasksRoute', () => {
|
||||
return 1
|
||||
})
|
||||
|
||||
navigateToMobileTasks({ push, replace }, 'host-1', 'github')
|
||||
expect(push).toHaveBeenCalledWith('/h/host-1')
|
||||
navigateToMobileTasks({ push, replace }, 'host/1', 'github')
|
||||
expect(push).toHaveBeenCalledWith('/h/host%2F1')
|
||||
expect(replace).not.toHaveBeenCalled()
|
||||
|
||||
nextFrame?.(0)
|
||||
expect(replace).toHaveBeenCalledWith(mobileTasksRoute('host-1', 'github'))
|
||||
vi.unstubAllGlobals()
|
||||
expect(replace).toHaveBeenCalledWith(mobileTasksRoute('host/1', 'github'))
|
||||
})
|
||||
})
|
||||
|
||||
@@ -21,7 +21,7 @@ export function navigateToMobileTasks(
|
||||
provider?: TaskProvider
|
||||
): void {
|
||||
// Why: a cold nested host navigator resolves a deep push to its index route.
|
||||
router.push(`/h/${hostId}`)
|
||||
router.push(`/h/${encodeURIComponent(hostId)}`)
|
||||
requestAnimationFrame(() => {
|
||||
router.replace(mobileTasksRoute(hostId, provider))
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user