Skip to content

Route priority: specific handlers should run before global/fallback handlers #351

@heyitsaamir

Description

@heyitsaamir

Problem

Handlers run in registration order. When a broad handler is registered before a specific one, the broad handler runs first and the specific handler never fires. This affects multiple handler levels:

  • @app.on_card_action_execute (global) swallows @app.on_card_action_execute("submit_feedback") (specific)
  • @app.on_dialog_open (global) swallows @app.on_dialog_open("my_form") (specific)
  • @app.on_dialog_submit (global) swallows @app.on_dialog_submit("save") (specific)
  • @app.on_invoke swallows all specific invoke handlers (on_dialog_open, on_card_action_execute, etc.)
  • @app.on_event swallows on_meeting_start, on_read_receipt, etc.
  • @app.on_conversation_update swallows on_channel_created, on_team_renamed, etc.
  • @app.on_message_update swallows on_edit_message, on_undelete_message
  • @app.on_message_delete swallows on_soft_delete_message
  • @app.on_installation_update swallows on_install_add, on_install_remove
  • @app.on_activity swallows everything

Users shouldn't have to worry about registration order.

Expected behavior

The router should prioritize more specific selectors over broader ones when multiple handlers match the same activity, regardless of registration order.

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