Skip to content

Commit

Permalink
fix additional props
Browse files Browse the repository at this point in the history
  • Loading branch information
kb019 committed Oct 11, 2024
1 parent 3e3adbb commit 732bde0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export function WorkspaceRenderer({ workspace, additionalPropsFromPage }: Worksp
[workspace, additionalPropsFromPage, workspaceFamilyState],
);
return lifecycle ? (
<Parcel key={workspace.key} config={lifecycle} mountParcel={mountRootParcel} {...props} />
<Parcel key={workspace.key || workspace.name} config={lifecycle} mountParcel={mountRootParcel} {...props} />
) : (
<InlineLoading className={styles.loader} description={`${getCoreTranslation('loading', 'Loading')} ...`} />
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ export function launchWorkspace<
const workspace = getWorkspaceRegistration(name);
const newWorkspace: OpenWorkspace = {
...workspace,
key: additionalProps?.key ?? workspace.name,
key: getWorkspaceKey(workspace,additionalProps),
title: getWorkspaceTitle(workspace, additionalProps),
closeWorkspace: (options: CloseWorkspaceOptions = {}) => closeWorkspace(name, options),
closeWorkspaceWithSavedChanges: (options: CloseWorkspaceOptions) =>
Expand Down Expand Up @@ -236,7 +236,7 @@ export function launchWorkspace<
if (openWorkspace.title === getWorkspaceTitle(openWorkspace, openWorkspace.additionalProps)) {
openWorkspace.title = getWorkspaceTitle(newWorkspace, newWorkspace.additionalProps);
}
openWorkspace.additionalProps = newWorkspace.additionalProps;
openWorkspace.additionalProps = Object.assign({}, openWorkspace.additionalProps, newWorkspace.additionalProps);
const restOfTheWorkspaces = openWorkspaces.filter((w) => w.name != name);
updateStoreWithNewWorkspace(openWorkspaces[workspaceIndexInOpenWorkspaces], restOfTheWorkspaces);
} else if (openedWorkspaceWithSameType) {
Expand Down Expand Up @@ -523,6 +523,9 @@ function getWorkspaceTitle(workspace: WorkspaceRegistration, additionalProps?: o
return additionalProps?.['workspaceTitle'] ?? workspace.title;
}

function getWorkspaceKey(workspace:WorkspaceRegistration,additionalProps?:object){
return additionalProps?.['key'] ?? workspace.key ?? workspace.name;
}
export function resetWorkspaceStore() {
getWorkspaceStore().setState(initialState);
}
Expand Down

0 comments on commit 732bde0

Please sign in to comment.