Skip to content

optimize messageAIO usage#529

Merged
minhsueh merged 4 commits intomainfrom
messageaio-v2
Apr 30, 2026
Merged

optimize messageAIO usage#529
minhsueh merged 4 commits intomainfrom
messageaio-v2

Conversation

@minhsueh
Copy link
Copy Markdown
Collaborator

@minhsueh minhsueh commented Apr 30, 2026

V1: The instantiated MessageAIO is limited to a single msg_type

This makes it difficult to use in applications with multiple message types, as developers need to instantiate multiple MessageAIO components and define multiple Outputs in the callback.

V2 improvement:

  • Use a single MessageAIO per app/page
  • Require only one Output per callback
  • Automatically handle visibility: when MessageAIO.ids.data changes, the message should be shown by default

Example using the Pourbaix component:

Layout:

                        MessageAIO(
                            aio_id=self.id("outputConsole"),
                        ),

Callback:

        @app.callback(
            Output(MessageAIO.ids.data(self.id("outputConsole")), "data"),
            ...
       )
       def make_figure(...):
            return {"message": "Invalid composition input!", "msg_type": "error"},

@minhsueh minhsueh merged commit 44be623 into main Apr 30, 2026
6 of 7 checks passed
@minhsueh minhsueh deleted the messageaio-v2 branch April 30, 2026 22:56
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.

1 participant