Skip to content

Conversation

@SAKSHI-DOT693
Copy link

Altair 6 introduces a new Vega-Lite MIME type (application/vnd.vegalite.v6+json).
FigureAltair currently assumes only v4/v5 MIME variants, which leads to a
KeyError and a full UI crash when charts are rendered with newer Altair
versions.

This change preserves the existing v4/v5 code path and adds a controlled
fallback for newer Vega-Lite MIME types by selecting the first available
Vega-Lite spec exposed by Altair. The intent is to maintain backward
compatibility while avoiding crashes caused by forward MIME version changes.

Notes

No behavior change for Altair ≤ 5

Prevents hard failures with newer Vega-Lite MIME variants

Scoped strictly to Vega-Lite rendering
No behavior change for Altair ≤ 5

Prevents hard failures with newer Vega-Lite MIME variants

Scoped strictly to Vega-Lite rendering

@EwoutH
Copy link
Contributor

EwoutH commented Jan 16, 2026

@maartenbreddels could you review this PR?

If this would fix #1127 that would be really useful

@SAKSHI-DOT693
Copy link
Author

Thanks for flagging this and for tagging @maartenbreddels.

This PR focuses specifically on making the Vega-Lite MIME handling more robust for newer Altair versions, by avoiding hard failures when newer MIME types (e.g. v6+) are emitted.

This overlaps with the behavior described in #1127, where the frontend encounters unexpected Vega-Lite state or MIME keys during the initial render.

If you’d prefer this PR to explicitly reference or add coverage for #1127 (e.g. via a small targeted test or adjustment), I’m happy to extend it — just let me know the preferred direction.

@SAKSHI-DOT693
Copy link
Author

I’ve tested this locally on Windows with Altair installed. The updated FigureAltair logic now renders successfully and gracefully selects the available Vega-Lite MIME spec without raising errors. No regressions observed in the existing behavior.

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.

3 participants