Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(tabs): keep connection for tabs-[INS-4778] #8266

Draft
wants to merge 13 commits into
base: feat/multiple-tab
Choose a base branch
from

Conversation

CurryYangxx
Copy link
Member

@CurryYangxx CurryYangxx commented Dec 24, 2024

Changes:

  • keep websocket&grpc&SSE connection for tabs
  • close connection after tab closed
    • use eventbus listen tab close event and close connection in event callback

@CurryYangxx CurryYangxx marked this pull request as draft December 24, 2024 02:56
@CurryYangxx CurryYangxx force-pushed the feat/keep-websocket-connection branch from 00aee7b to 404d75e Compare December 24, 2024 03:05
@CurryYangxx CurryYangxx changed the title feat(tabs): keep websocket connection feat(tabs): keep connection for tabs Dec 26, 2024
Comment on lines -455 to -461
// Close all websocket connections when the active environment changes
useEffect(() => {
return () => {
window.main.webSocket.closeAll();
window.main.grpc.closeAll();
};
}, [activeEnvironment?._id]);
Copy link
Member Author

Choose a reason for hiding this comment

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

This a trade-off; Previously, we closed all connections when the active environment changed to avoid users not knowing which URL is currently used to connect if included some env.
Now, based on multiple tabs, we may have multiple WebSocket or grpc tabs from different workspaces, and we want to keep all the connections when the corresponding tab exists. When a workspace's active environment changes, finding which requests are affected and closing them will introduce more complexity.
So I just delete it and only close connection when tab close.

@CurryYangxx CurryYangxx changed the title feat(tabs): keep connection for tabs feat(tabs): keep connection for tabs-[INS-4778] Dec 26, 2024
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.

1 participant