Skip to content

fix: Incorrect handling of events-[INS-779] - #8876

Merged
CurryYangxx merged 1 commit into
developfrom
fix/sse-connection
Jul 22, 2025
Merged

fix: Incorrect handling of events-[INS-779]#8876
CurryYangxx merged 1 commit into
developfrom
fix/sse-connection

Conversation

@CurryYangxx

@CurryYangxx CurryYangxx commented Jul 17, 2025

Copy link
Copy Markdown
Member
  • FileDeleted
    Delete a workspace file, we don't need to sync projects
  • FileChange
    Add a new file or modify the file, we only need to submit insomnia-sync/sync-data action when the current workspace is the same as the remote file
    If on the project page, revalidate to get new workspace list.
  • BranchDeleted
    We only need to submit insomnia-sync/sync-data action when the current workspace is the same as the remote file

@CurryYangxx
CurryYangxx requested a review from ZxBing0066 July 17, 2025 07:26
@CurryYangxx CurryYangxx changed the title fix: Incorrect handling of events fix: Incorrect handling of events-[INS-779] Jul 17, 2025
Comment on lines +79 to +94
const isSameWorkspaceWithRemote = (workspaceId: string | undefined, remoteWorkspaceId: string | undefined) => {
if (!workspaceId || !remoteWorkspaceId) {
return false;
}
const vcs = VCSInstance();
const currentBackendProject = vcs.getActiveBackendProject();
if (
currentBackendProject &&
currentBackendProject?.id === remoteWorkspaceId &&
currentBackendProject.rootDocumentId === workspaceId
) {
return true;
}
return false;
};

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It could be simpler.

Suggested change
const isSameWorkspaceWithRemote = (workspaceId: string | undefined, remoteWorkspaceId: string | undefined) => {
if (!workspaceId || !remoteWorkspaceId) {
return false;
}
const vcs = VCSInstance();
const currentBackendProject = vcs.getActiveBackendProject();
if (
currentBackendProject &&
currentBackendProject?.id === remoteWorkspaceId &&
currentBackendProject.rootDocumentId === workspaceId
) {
return true;
}
return false;
};
const isSameWorkspaceWithRemote = (workspaceId: string | undefined, remoteWorkspaceId: string | undefined) => {
const vcs = VCSInstance();
const currentBackendProject = vcs.getActiveBackendProject();
if (
workspaceId && remoteWorkspaceId &&
currentBackendProject?.id === remoteWorkspaceId &&
currentBackendProject?.rootDocumentId === workspaceId
) {
return true;
}
return false;
};

(event.type === 'FileChanged' || event.type === 'BranchDeleted') &&
event.team === organizationId &&
latestRemoteId.current &&
event.project === latestRemoteId.current

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we reuse isSameWorkspace here?

@CurryYangxx
CurryYangxx force-pushed the fix/sse-connection branch 2 times, most recently from 1479bfb to 8d69384 Compare July 21, 2025 09:30
@CurryYangxx
CurryYangxx merged commit 10a79ba into develop Jul 22, 2025
@CurryYangxx
CurryYangxx deleted the fix/sse-connection branch July 22, 2025 03:23
RoamingLost pushed a commit to RoamingLost/insomnia that referenced this pull request Aug 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants