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

dispose saved text model with wrong view type #209461

Merged
merged 1 commit into from
Apr 3, 2024
Merged

Conversation

amunger
Copy link
Contributor

@amunger amunger commented Apr 3, 2024

fix #208016

as mentioned in this comment, when we save as on a notebook model, we leave the newly created model orphaned, to be picked up by the editor that is about to be created with the new resource.
In the case of saving an interactive window, we are saving the model with the interactive viewtype, since the model factory in the interactive working copy has that viewtype, but the new editor will open with the notebook viewtype.

We can fix this by just disposing the new model that we create, and the editor will resolve another model with the correct viewtype.

@amunger amunger requested a review from bpasero April 3, 2024 16:46
@amunger amunger marked this pull request as ready for review April 3, 2024 16:46
@amunger amunger requested a review from rebornix April 3, 2024 16:46
@amunger
Copy link
Contributor Author

amunger commented Apr 3, 2024

It feels like it would be better to just choose the viewtype while saving, but I don't see a clean way to pipe that through the current code flow, but maybe there is a way to shortcut the text model creation that I'm missing.

@amunger amunger merged commit 23860e9 into main Apr 3, 2024
7 checks passed
@amunger amunger deleted the aamunger/openSavedIW branch April 3, 2024 18:40
@bpasero
Copy link
Member

bpasero commented Apr 7, 2024

Isn't the model disposed automatically once the editor closes the old one and opens the new one? There should not be a reference anymore after saving, or?

@amunger
Copy link
Contributor Author

amunger commented Apr 8, 2024

The path used to save is not the same as the one the open editor was using (similar to saving an unsaved notebook)

The open editor is /interactive-1.interactive with view type 'interactive
A new text model is created just to save for {saved-path}.ipynb with view type 'interactive'
A new editor is opened for {saved-path}.ipynb with view type 'notebook'

@microsoft microsoft locked and limited conversation to collaborators Jun 10, 2024
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.

Unable to open the ipynb file once an interactive window is saved
3 participants