Skip to content

Clarify pendingActionsStream buffering behavior for cold start #17

@touyou

Description

@touyou

Summary

When using pendingActionsStream and onIntentExecution together, there is a potential race condition during cold start.

Setup (typical usage)

// In main() — registered early
AppIntents().pendingActionsStream.listen((_) async {
  await AppIntents().processPendingActions();
});

// In Widget (e.g., GlobalTabBar) — registered later during widget tree build
AppIntents().onIntentExecution('com.habee.createPost', (params) async {
  // handle intent
});

Concern

If processPendingActions() fires before the widget-level onIntentExecution listener is registered (e.g., during cold start when the widget tree hasn't been built yet), the intent execution may be silently dropped.

Request

  1. Document whether onIntentExecution callbacks are buffered/replayed when processPendingActions() is called before listeners are registered.
  2. If events are not buffered, document the recommended initialization order to avoid this race condition.
  3. Consider adding a replay/buffer mechanism so that intents received during startup are not lost.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions