Skip to content

JupyterChart accesses .changed property in callbacks #3868

@azjps

Description

@azjps

What happened?

In JupyterChart #3119, .changed I think is an implementation detail in Jupyter's backbone.js patch, and isn't supported in other AFM implementations such as marimo's:

Image

This is using the JupyterChart example in the docs.

If I overwrite the anywidget ESM with

class AltairChart(altair.JupyterChart):
     _esm = """
            // ... rest of https://github.com/vega/altair/blob/5e3a0c7bcb2ebc74fbcaec47d4c9b6ec7828b1d9/altair/jupyter/js/index.js
            // for (const [param, value] of Object.entries(new_params.changed._params)) {
            for (const [param, value] of Object.entries(new_params)) {
     """

these errors go away and appears to work in both jupyter & marimo. I'm not sure if there's some other impact of this change though.

I came across this while trying to debug an AFM implementation in nicegui: zauberzeug/nicegui#5096 (reply in thread). Separately, I'm having trouble getting the binded JS interactions to work and don't have any leads, if someone would have advice on that?

What would you like to happen instead?

No console errors.

Which version of Altair are you using?

Tried with both altair=6 and altair=5.5.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugneeds-triageBug report needs maintainer response

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions