-
Notifications
You must be signed in to change notification settings - Fork 27
Description
Currently when the frontend refreshes, the UI tear down happens so fast that the frontend doesn't get a chance to send comm close messages for comms that are destructed. Then the new frontend instance opens new comms (except for help and plots).
In the case of the UI comm, we replace the existing comm on the Ark side and drop it, but we don't tell anyone about it. The primary symptom of that is that Amalthea keeps bumping the comm count on refresh (see log messages in posit-dev/positron#1126).
One way to fix this is for the frontend to reuse existing comms, like we do for help and plots (see posit-dev/positron#1126 (comment)).
But we should have a reasonable closing procedure in any case. Two ways to go about it:
- Tell Amalthea the comm is closed via an event (there's one for this already). This doesn't propagate to the frontend.
- Send a proper
comm_closethat propagates all the way to the frontend.
(2) feels a little better to me architecturally, even though the frontend will not be able to match the comm close id to a known comm. After all it's the frontend's fault for not sending comm_close messages, and we should still properly close the comm from the backend since it was not closed from the frontend. Presumably the frontend will silently drop that notification with a log message, without showing a user visible toast (to verify).