Skip to content
This repository has been archived by the owner on Dec 15, 2022. It is now read-only.

Close remote buffers on guest when host closes portal #319

Merged
merged 3 commits into from
Feb 8, 2018

Conversation

jasonrudolph
Copy link
Contributor

@jasonrudolph jasonrudolph commented Feb 7, 2018

Description of the Change

This change addresses the following item from the task list in #268:

In the discussion in 9d9f74c#commitcomment-26310833, we observed that it's often "annoying that the host's buffers persist as unsaved files after they close their portal. With one editor, it was fine, but now there are quite a few tabs to clean up after a host terminates their session." With the changes in this pull request, when the host closes the portal, Teletype will clean up the guest's workspace to remove the closed portal's tabs.

Verification Process

  • When the host closes the portal, verify that all the portal's tabs are closed on the guest
  • When a guest is participating in multiple portals (A & B), verify that when portal A is closed by the host, portal A's tabs are closed on the guest, but portal B's tabs remain open on the guest
  • When the guest leaves a portal, verify that all the portals tabs are closed on the guest (i.e., the same behavior that existed prior to this pull request)
  • When the guest closes the last remote editor for a portal, verify that the guest leaves the portal (i.e., the same behavior that existed prior to this pull request)
  • When the host closes the last editor in their workspace, verify that the guest sees the empty portal pane item (i.e., the same behavior that existed prior to this pull request)

@jasonrudolph
Copy link
Contributor Author

@as-cii: I think this is almost ready to merge, but there's one regression that I'm observing: Prior to this pull request, when the host closes the portal, the guest sees a notification saying that the portal was closed. With the changes in this pull request, the guest no longer sees that notification; they just see all the remote tabs get closed. I think it's important for Teletype to show this notification, so that the guest understands why the tabs were closed.

I haven't yet had a chance to look into addressing this regression, but I think that's the next step for moving forward with this pull request.

Co-authored-by: Jason Rudolph <jason@jasonrudolph.com>
@as-cii as-cii force-pushed the close-remote-tabs-when-guest-leaves-portal branch from 1e002eb to ca0873f Compare February 8, 2018 08:47
This fixes a regression introduced in the previous commit that was
causing notification to not appear when host closed the portal or lost
the connection.

Specifically, these notifications were not appearing because
GuestPortalBinding interpreted closing remote tabs as being a
user-initiated action, instead of as a result of the host tearing down
their portal. Thus, when the last tab was being closed the guest would
mistakenly leave the portal instead of being kicked out of it.

With this commit we rely on when `editorBinding.onDidDispose` is fired
to determine if the editor was destroyed manually or by the host. In
particular, if `onDidDispose` is called before actually destroying the
pane item associated with the editor, it means that
`EditorProxy.dispose` was called first and the host wanted to tear down
that particular editor. Otherwise, if we haven't processed the binding
`onDidDispose` event when an editor is destroyed it means the editor was
destroyed by the user.
@as-cii as-cii force-pushed the close-remote-tabs-when-guest-leaves-portal branch from ca0873f to ecdd3bf Compare February 8, 2018 08:49
@as-cii as-cii merged commit 8b5ad75 into master Feb 8, 2018
@as-cii as-cii deleted the close-remote-tabs-when-guest-leaves-portal branch February 8, 2018 08:57
jasonrudolph added a commit that referenced this pull request Feb 8, 2018
Prior to #319, when the host closed the portal, Teletype would transform
the remote editors in the guest's workspace into local untitled/unsaved
editors. As of #319, when the host closed the portal, Teletype *closes*
remote editors in the guest's workspace. As a result, we no longer need
the logic for transforming the remote editors into local editors.
@jasonrudolph
Copy link
Contributor Author

A quick before-and-after demo of the guest's experience when the host closes the portal:

Before: So many tabs to close 🙀

before

After: Such a clean workspace 🧘‍♂️

after

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants