Repository navigation
Conversation
StepPopped mutated activity.steps in place via Array#pop, unlike every other reducer in this file which derives a new array. Build the popped steps as a new array instead so callers that still hold a reference to the previous activity aren't affected.
|
|
Important Review skippedReview was skipped as selected files did not have any reviewable changes.
|
| Layer / File(s) | Summary |
|---|---|
Non-mutating step pop core/src/activity-utils/makeActivityReducer.ts, core/src/activity-utils/makeActivityReducer.spec.ts |
StepPopped uses slice(0, -1) to create the remaining steps and derive params. The test checks that the original steps array remains unchanged and that the returned activity has the expected steps and params. |
Estimated code review effort: 2 (Simple) | ~10 minutes
Change: Bug fix
Suggested reviewers: orionmiz
Merge Risk: 
Minimal · previous review c9132
-
The reducer now preserves the prior activity’s steps while returning the popped result, and the added test checks that behavior. No actionable merge risk remains in the supplied full-change context.
Pre-merge checks: 
4 · 
1
-
Failed checks: 1 warning Passed checks: 4 passed -
Finishing Touches
-
🧪 Generate unit tests (beta)
-
- Create a new PR
-
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
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.
Summary
Fix the
StepPoppedactivity reducer so it no longer mutates the previousactivity's
stepsarray in place.Motivation
In
core/src/activity-utils/makeActivityReducer.ts, every reducer derives anew array when changing
steps(e.g.StepPusheduses[...activity.steps, newRoute]), exceptStepPoppedWhat I have done
Test Plans
Test Results