fix: pin workbar tab order and preserve browser titles

This commit is contained in:
mesalogo
2026-09-10 08:46:17 +08:00
parent c1848a9dc4
commit fedafa21bd
13 changed files with 209 additions and 41 deletions
+15 -3
View File
@@ -107,7 +107,7 @@ export const WORKBAR_APP_DEFINITIONS = [
defaultOpen: true,
required: true,
closable: false,
reorderable: true,
reorderable: false,
availability: { state: 'available' }
},
{
@@ -121,7 +121,7 @@ export const WORKBAR_APP_DEFINITIONS = [
defaultOpen: true,
required: true,
closable: false,
reorderable: true,
reorderable: false,
availability: { state: 'available' }
},
{
@@ -317,6 +317,18 @@ export type WorkbarLayoutPreferences = z.infer<
typeof workbarLayoutPreferencesSchema
>
export function orderWorkbarInstances(
instances: readonly WorkbarTabInstance[]
): WorkbarTabInstance[] {
return [
...instances.filter((instance) => instance.appId === 'tasks'),
...instances.filter((instance) => instance.appId === 'workspace'),
...instances.filter(
(instance) => instance.appId !== 'tasks' && instance.appId !== 'workspace'
)
]
}
export function normalizeWorkbarLayoutPreferences(
value: unknown,
defaultInstances: readonly WorkbarTabInstance[]
@@ -374,7 +386,7 @@ export function normalizeWorkbarLayoutPreferences(
)
}
const boundedInstances = instances.slice(
const boundedInstances = orderWorkbarInstances(instances).slice(
0,
WORKBAR_LIMITS.maximumOpenInstances
)