Skip to content

fix(core): resume without queued events#739

Merged
ENvironmentSet merged 3 commits into
mainfrom
feature/fep-2636
Jul 26, 2026
Merged

fix(core): resume without queued events#739
ENvironmentSet merged 3 commits into
mainfrom
feature/fep-2636

Conversation

@ENvironmentSet

@ENvironmentSet ENvironmentSet commented Jul 24, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Resume a paused Stack even when no events were queued after pause().
  • Restore globalTransitionState to idle or loading from the current Activity transitions when resuming.
  • Add aggregate and core-store regression coverage, including onResumed and subsequent navigation.

Linear: FEP-2636

@coderabbitai

coderabbitai Bot commented Jul 24, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Summary by CodeRabbit

  • Bug Fixes

    • Fixed an issue where resuming after a pause with no queued navigation events could leave the stack paused.
    • Resuming now correctly restores the stack’s transition state and allows new activities to be pushed.
    • Preserved accurate transition states when resuming during active activity transitions.
  • Tests

    • Added coverage for resume behavior with no queued events, including event processing and resume hooks.
  • Chores

    • Released a patch update for @stackflow/core.

Walkthrough

The Resumed reducer now handles paused stacks without queued events, restores the appropriate transition state, and is covered by aggregation and core store tests. A changeset records the patch release for @stackflow/core.

Changes

Resume without queued events

Layer / File(s) Summary
Handle empty paused event queues
core/src/activity-utils/makeStackReducer.ts
The Resumed reducer processes paused stacks without queued events and derives globalTransitionState from remaining activity transition states.
Validate resume behavior
core/src/aggregate.spec.ts, core/src/makeCoreStore.spec.ts, .changeset/fep-2636-resume-without-queued-events.md
Tests cover aggregation, store state restoration, the onResumed hook, emitted events, and subsequent pushes; the changeset records a patch release.

Estimated code review effort: 2 (Simple) | ~10 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main change: resuming a stack without queued events.
Description check ✅ Passed The description is clearly related to the changeset and matches the implemented resume-behavior fix.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/fep-2636

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@changeset-bot

changeset-bot Bot commented Jul 24, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 060a256

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@stackflow/core Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@pkg-pr-new

pkg-pr-new Bot commented Jul 24, 2026

Copy link
Copy Markdown
@stackflow/core

yarn add https://pkg.pr.new/daangn/stackflow/@stackflow/core@739.tgz

@stackflow/link

yarn add https://pkg.pr.new/daangn/stackflow/@stackflow/link@739.tgz

@stackflow/plugin-activity-guard

yarn add https://pkg.pr.new/daangn/stackflow/@stackflow/plugin-activity-guard@739.tgz

@stackflow/plugin-basic-ui

yarn add https://pkg.pr.new/daangn/stackflow/@stackflow/plugin-basic-ui@739.tgz

@stackflow/plugin-blocker

yarn add https://pkg.pr.new/daangn/stackflow/@stackflow/plugin-blocker@739.tgz

@stackflow/plugin-devtools

yarn add https://pkg.pr.new/daangn/stackflow/@stackflow/plugin-devtools@739.tgz

@stackflow/plugin-google-analytics-4

yarn add https://pkg.pr.new/daangn/stackflow/@stackflow/plugin-google-analytics-4@739.tgz

@stackflow/plugin-history-sync

yarn add https://pkg.pr.new/daangn/stackflow/@stackflow/plugin-history-sync@739.tgz

@stackflow/plugin-lifecycle

yarn add https://pkg.pr.new/daangn/stackflow/@stackflow/plugin-lifecycle@739.tgz

@stackflow/plugin-renderer-basic

yarn add https://pkg.pr.new/daangn/stackflow/@stackflow/plugin-renderer-basic@739.tgz

@stackflow/plugin-renderer-web

yarn add https://pkg.pr.new/daangn/stackflow/@stackflow/plugin-renderer-web@739.tgz

@stackflow/plugin-sentry

yarn add https://pkg.pr.new/daangn/stackflow/@stackflow/plugin-sentry@739.tgz

@stackflow/plugin-stack-depth-change

yarn add https://pkg.pr.new/daangn/stackflow/@stackflow/plugin-stack-depth-change@739.tgz

@stackflow/plugin-stack-persistence

yarn add https://pkg.pr.new/daangn/stackflow/@stackflow/plugin-stack-persistence@739.tgz

@stackflow/react-ui-core

yarn add https://pkg.pr.new/daangn/stackflow/@stackflow/react-ui-core@739.tgz

@stackflow/react

yarn add https://pkg.pr.new/daangn/stackflow/@stackflow/react@739.tgz

commit: 60d4c7f

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Jul 24, 2026

Copy link
Copy Markdown

Deploying stackflow-demo with  Cloudflare Pages  Cloudflare Pages

Latest commit: 060a256
Status:⚡️  Build in progress...

View logs

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Jul 24, 2026

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
stackflow-docs 060a256 Commit Preview URL Jul 26 2026, 04:38 PM

@ENvironmentSet
ENvironmentSet marked this pull request as ready for review July 24, 2026 07:36
@ENvironmentSet
ENvironmentSet enabled auto-merge (squash) July 24, 2026 07:36

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
core/src/aggregate.spec.ts (1)

4135-4162: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Cover the new loading branch.

This test only exercises resumption with no active transitions, so it cannot catch regressions in the new enter-active/exit-active path that should restore globalTransitionState to "loading".

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@core/src/aggregate.spec.ts` around lines 4135 - 4162, Add coverage in the
aggregate test for the loading branch by constructing events with an active
transition before the Paused and Resumed events, such as an
enter-active/exit-active sequence. Assert that Resumed restores
globalTransitionState to "loading" while retaining the expected pausedEvents and
event list behavior; keep the existing idle-state scenario unchanged.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@core/src/aggregate.spec.ts`:
- Around line 4135-4162: Add coverage in the aggregate test for the loading
branch by constructing events with an active transition before the Paused and
Resumed events, such as an enter-active/exit-active sequence. Assert that
Resumed restores globalTransitionState to "loading" while retaining the expected
pausedEvents and event list behavior; keep the existing idle-state scenario
unchanged.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 4cd72b25-6a42-4412-8d81-045684dcf8ce

📥 Commits

Reviewing files that changed from the base of the PR and between 2431b41 and 60d4c7f.

📒 Files selected for processing (4)
  • .changeset/fep-2636-resume-without-queued-events.md
  • core/src/activity-utils/makeStackReducer.ts
  • core/src/aggregate.spec.ts
  • core/src/makeCoreStore.spec.ts

@ENvironmentSet
ENvironmentSet merged commit 9535716 into main Jul 26, 2026
6 of 8 checks passed
@ENvironmentSet
ENvironmentSet deleted the feature/fep-2636 branch July 26, 2026 16:35
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