Skip to content

Commit a10dde0

Browse files
authored
Fix merge location (#10295)
Signed-off-by: Denis Bykhov <bykhov.denis@gmail.com>
1 parent 479b697 commit a10dde0

File tree

2 files changed

+11
-9
lines changed

2 files changed

+11
-9
lines changed

plugins/card-resources/src/utils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ async function generateLocation (loc: Location, id: string): Promise<ResolvedLoc
210210
fragment: getPanelURI(component, doc._id, doc._class, 'content')
211211
},
212212
defaultLocation: {
213-
path: [appComponent, workspace, cardId, 'type', special],
213+
path: [appComponent, workspace, cardId, doc.space, special],
214214
fragment: getPanelURI(component, doc._id, doc._class, 'content')
215215
}
216216
}

plugins/workbench-resources/src/components/Workbench.svelte

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -378,9 +378,9 @@
378378
loc.path[3] = currentSpace ?? currentSpecial ?? resolved.defaultLocation.path[3]
379379
if (loc.path[3] !== undefined && isSameApp) {
380380
// setting space special/aside only if it belongs to the same app
381-
if (currentSpace && currentSpecial) {
382-
loc.path[4] = currentSpecial
383-
} else if (loc.path[3] === resolved.defaultLocation.path[3]) {
381+
if (currentSpace) {
382+
loc.path[4] = currentSpecial ?? resolved.defaultLocation.path[4]
383+
} else if (currentSpecial) {
384384
loc.path[4] = resolved.defaultLocation.path[4]
385385
}
386386
} else {
@@ -390,16 +390,18 @@
390390
} else {
391391
loc.path[2] = resolvedApp
392392
if (resolvedSpace === undefined) {
393-
loc.path[3] = currentSpace ?? (currentSpecial as string) ?? resolved.defaultLocation.path[3]
394-
loc.path[4] = (currentSpecial as string) ?? resolved.defaultLocation.path[4]
393+
loc.path[3] = currentSpace ?? currentSpecial ?? resolved.defaultLocation.path[3]
394+
loc.path[4] = currentSpecial ?? resolved.defaultLocation.path[4]
395395
} else {
396396
loc.path[3] = resolvedSpace
397397
if (resolvedSpecial) {
398398
loc.path[4] = resolvedSpecial
399-
} else if (currentSpace && currentSpecial) {
400-
loc.path[4] = currentSpecial
401-
} else {
399+
} else if (currentSpace) {
400+
loc.path[4] = currentSpecial ?? resolved.defaultLocation.path[4]
401+
} else if (currentSpecial) {
402402
loc.path[4] = resolved.defaultLocation.path[4]
403+
} else {
404+
loc.path.length = 4
403405
}
404406
}
405407
}

0 commit comments

Comments
 (0)