Skip to content

Commit

Permalink
setting rootWebPageId of your current location against your current c…
Browse files Browse the repository at this point in the history
…onnection in container (#789)
  • Loading branch information
ritikramuka authored Dec 8, 2023
1 parent 26fac4e commit 323293b
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/web/client/common/interfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ export interface IAttributePath {
export interface IEntityInfo {
entityId: string;
entityName: string;
rootWebPageId?: string;
}

export interface IFileInfo {
Expand Down
8 changes: 7 additions & 1 deletion src/web/client/common/worker/webworker.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,13 @@ async function loadContainer(config, swpId, entityInfo) {

const existingMembers = audience.getMembers();

// TODO: yet to be decided how entity id will be passed in container from vscode side
const myself = audience.getMyself();

if (audience && myself) {
const myConnectionId = audience['container'].clientId;
const entityIdObj = new Array(entityInfo.rootWebPageId);
(await container.initialObjects.sharedState.get('selection').get()).set(myConnectionId, entityIdObj);
}

audience.on("memberRemoved", (clientId, member) => {
if (!existingMembers.get(member.userId)) {
Expand Down
3 changes: 2 additions & 1 deletion src/web/client/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,8 @@ export function processWorkspaceStateChanges(context: vscode.ExtensionContext) {
const document = tab.input;
const entityInfo: IEntityInfo = {
entityId: getFileEntityId(document.uri.fsPath),
entityName: getFileEntityName(document.uri.fsPath)
entityName: getFileEntityName(document.uri.fsPath),
rootWebPageId: WebExtensionContext.entityDataMap.getEntityMap.get(getFileEntityId(document.uri.fsPath))?.rootWebPageId as string
};
if (entityInfo.entityId && entityInfo.entityName) {
context.workspaceState.update(document.uri.fsPath, entityInfo);
Expand Down

0 comments on commit 323293b

Please sign in to comment.