Skip to content

Preserving the type of the output of callbacks #129

Open

Description

@JinraeKim

Hi,
I'm new to Dash.jl so the terminology may be confusing.

In my case, I'd like to send a ComponentArray (exported from ComponentArrays.jl) from a callback to another callback.

I found that after passing through a callback, ComponentArray becomes a normal array (Vector).
Is it possible to make Dash.jl compatible with ComponentArray or any other abstract array types?

Because of the powerful abstraction of ComponentArrary and other cool array types in Julia, preserving array type would be really helpful for dealing with data manipulation.

Activity

  1. JinraeKim commented on Sep 19, 2021

    @JinraeKim
    Author

    I don't know how Dash.jl works but I guess that adding a layer only to the callbacks whose output is "shown on web" will work. Probably...?

  2. changed the title [-]passed through [/-] [+]Preserving the type of the output of callbacks[/+] on Sep 19, 2021
  3. waralex commented on Oct 24, 2021

    @waralex
    Contributor

    @JinraeKim The fact is that the result of the callback turns into json and is sent to the front end (i.e. to JavaScript code). The frontend knows nothing about Julia types, and in general about backend types.

    As an idea for the future development of Dash.jl maybe I will make it possible to type the input parameters of callbacks. But it will work the same way, just the json coming from the frontend will not be parsed into the default type (dict or vector), but into a custom type according to some user-defined rules. But you can do the same now inside the callback, typing will just be a convenient wrapper so that the conversion happens automatically.

  4. alexcjohnson commented on Oct 25, 2021

    @alexcjohnson
    Contributor

    Related: plotly/dash#1784 - not merged yet, but allows keeping some type info in the front end such that when returning it to the back end in a callback that type can be reconstructed... as well as supporting alternate and possibly more efficient serializations for certain types. If you'd like to look at that implementation and comment on how to make it more useful to Julia in the future, now's the time :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions