Skip to content

Do not sync Variables pane for a Data Explorer "editor"#12219

Merged
juliasilge merged 3 commits intomainfrom
bugfix/data-explorer-should-not-sync-variables
Mar 4, 2026
Merged

Do not sync Variables pane for a Data Explorer "editor"#12219
juliasilge merged 3 commits intomainfrom
bugfix/data-explorer-should-not-sync-variables

Conversation

@juliasilge
Copy link
Contributor

Addresses #7539

When a user opens the Data Explorer from a notebook's Variables pane, the Variables pane would incorrectly switch to the foreground console session instead of staying on the notebook session. This happened because the _syncToActiveEditor() method thought the Data Explorer "editor" was just a regular old editor, causing it to fall through to the default behavior of switching to the foreground console session.

This PR makes the Data Explorer "transparent" to session following; when a Data Explorer editor becomes active, the Variables pane now stays on whichever session it was showing. This preserves the context for users working in a notebook.

Release Notes

New Features

  • N/A

Bug Fixes

QA Notes

@:variables @:data-explorer @:notebooks

  1. Open a Jupyter notebook
  2. Create a dataframe:
import pandas as pd
df = pd.DataFrame({"a": [1, 2, 3]})
  1. Execute the cell
  2. In the Variables pane, verify the session shows the notebook name
  3. Click the data viewer icon on the df variable to open it
  4. Verify the Variables pane still shows the notebook session (not the console)

@github-actions
Copy link

github-actions bot commented Mar 2, 2026

E2E Tests 🚀
This PR will run tests tagged with: @:critical @:variables @:data-explorer @:notebooks

readme  valid tags

await notebooks.assertCellOutput('Modified numbers: [1, 2, 3, 4, 5, 6]');
});

test('Python - Verify Variables pane stays on notebook session after opening Data Explorer', {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This test runs with the legacy notebook editor, which I think is fine for now. The fix applies to both notebook types since it's in the Variables service.

@juliasilge juliasilge marked this pull request as ready for review March 3, 2026 17:13
@juliasilge juliasilge requested a review from nstrayer March 3, 2026 17:13
Copy link
Contributor

@nstrayer nstrayer left a comment

Choose a reason for hiding this comment

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

Looks good to me.

I do think we're approaching a point in this conditional logic where we want to white-list when we do switch rather than decide when we dont.

For example if you switch from a quarto doc to the settings pane right now it will change the variables, which feels a bit odd. Out of scope for this PR but a future note.

@juliasilge juliasilge merged commit 9603c22 into main Mar 4, 2026
21 checks passed
@juliasilge juliasilge deleted the bugfix/data-explorer-should-not-sync-variables branch March 4, 2026 15:22
@github-actions github-actions bot locked and limited conversation to collaborators Mar 4, 2026
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