Skip to content

[1227E] - #8858

Draft
jvega190 wants to merge 1 commit into
craftersoftware:developfrom
jvega190:bugfix/1227E
Draft

[1227E]#8858
jvega190 wants to merge 1 commit into
craftersoftware:developfrom
jvega190:bugfix/1227E

Conversation

@jvega190

@jvega190 jvega190 commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

https://github.com/craftersoftware/craftercms-e/issues/1227

Summary by CodeRabbit

  • Bug Fixes
    • Improved path navigation reliability when users move between folders quickly.
    • Prevented outdated loading results from replacing content for the currently selected path.
    • Improved handling of failed folder and parent-item requests after navigation changes.
    • Ensured refresh and bulk-loading operations apply results only to the path that initiated them.
    • Preserved accurate breadcrumbs and navigation state during rapid changes and asynchronous loading.

@jvega190 jvega190 changed the title [1227] [1227E] Aug 3, 2026
@coderabbitai

coderabbitai Bot commented Aug 3, 2026

Copy link
Copy Markdown

Review Change Stack

Walkthrough

The path navigator now carries request paths through asynchronous actions and validates them in reducers. Stale successes, failures, and parent-item responses are ignored. Refresh and parent-item 404 recovery only resets to the root when the requested path remains active.

Changes

Path-aware navigation

Layer / File(s) Summary
Propagate request paths through navigation flows
studio-ui/ui/app/src/state/actions/pathNavigator.ts, studio-ui/ui/app/src/state/epics/pathNavigator.ts
Completion and failure actions now include requested or captured paths across refresh, fetch, pagination, keyword, and parent-item flows. Bulk failures now identify requests with { id, path }.
Filter stale results in the reducer
studio-ui/ui/app/src/state/reducers/pathNavigator.ts
The reducer updates the active path when a request starts and ignores results when the navigator is missing or its current path differs from the request path.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
  participant PathRequest
  participant pathNavigatorEpics
  participant pathNavigatorReducer
  PathRequest->>pathNavigatorEpics: request navigation or refresh
  pathNavigatorEpics->>pathNavigatorReducer: start fetch with requested path
  pathNavigatorEpics->>pathNavigatorReducer: complete or fail with path
  pathNavigatorReducer->>pathNavigatorReducer: compare requested path with current path
Loading

Possibly related PRs

Suggested reviewers: jmendeza

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Title check ❓ Inconclusive The title contains only issue number 1227 and does not describe the path navigator changes. Use a concise title that states the main change, such as adding stale-result handling to the path navigator.
✅ Passed checks (4 passed)
Check name Status Explanation
Description check ✅ Passed The description provides the required issue reference through a link to issue 1227.
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 unit tests (beta)
  • Create PR with unit tests

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

@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.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
studio-ui/ui/app/src/state/reducers/pathNavigator.ts (1)

152-172: 🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win

pathNavigatorConditionallySetPath is the one flow left out of the new stale-result protection. Every other completion/failure action in this PR now discards results when the navigator has moved on; pathNavigatorConditionallySetPath's round-trip does not, even though it is the action used to recover from a 404 during navigation.

  • studio-ui/ui/app/src/state/reducers/pathNavigator.ts#L152-L172: add path to pathNavigatorConditionallySetPathFailed's payload, move currentPath immediately in the pathNavigatorConditionallySetPath case (mirroring pathNavigatorFetchPath), and guard pathNavigatorConditionallySetPathComplete/Failed with isStaleResult, as shown in the per-file proposed fix.
  • studio-ui/ui/app/src/state/epics/pathNavigator.ts#L138-L148: once the reducer guard exists, forward the request path through pathNavigatorConditionallySetPath's completion/failure so this fallback benefits from it.
  • studio-ui/ui/app/src/state/epics/pathNavigator.ts#L384-L387: same change for the second pathNavigatorConditionallySetPath dispatch site.
🤖 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 `@studio-ui/ui/app/src/state/reducers/pathNavigator.ts` around lines 152 - 172,
Update studio-ui/ui/app/src/state/reducers/pathNavigator.ts lines 152-172:
include path in pathNavigatorConditionallySetPathFailed, set currentPath
immediately in pathNavigatorConditionallySetPath, and guard
pathNavigatorConditionallySetPathComplete and
pathNavigatorConditionallySetPathFailed with isStaleResult. Update
studio-ui/ui/app/src/state/epics/pathNavigator.ts lines 138-148 and 384-387 to
forward the request path through both pathNavigatorConditionallySetPath
completion and failure dispatches.
🤖 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.

Outside diff comments:
In `@studio-ui/ui/app/src/state/reducers/pathNavigator.ts`:
- Around line 152-172: Update
studio-ui/ui/app/src/state/reducers/pathNavigator.ts lines 152-172: include path
in pathNavigatorConditionallySetPathFailed, set currentPath immediately in
pathNavigatorConditionallySetPath, and guard
pathNavigatorConditionallySetPathComplete and
pathNavigatorConditionallySetPathFailed with isStaleResult. Update
studio-ui/ui/app/src/state/epics/pathNavigator.ts lines 138-148 and 384-387 to
forward the request path through both pathNavigatorConditionallySetPath
completion and failure dispatches.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 13a7e10b-be56-4cd7-9307-5647eb3e9b3f

📥 Commits

Reviewing files that changed from the base of the PR and between 57c06c7 and 22eeacd.

📒 Files selected for processing (3)
  • studio-ui/ui/app/src/state/actions/pathNavigator.ts
  • studio-ui/ui/app/src/state/epics/pathNavigator.ts
  • studio-ui/ui/app/src/state/reducers/pathNavigator.ts

@jvega190

jvega190 commented Aug 3, 2026

Copy link
Copy Markdown
Contributor Author

@coderabbitai about the outside diff range comment, pathNavigatorFetchPath can move currentPath immediately because navigation is committed. ConditionallySetPath is different: it probes a candidate and only adopts it on success when parent.childrenCount > 0.
If you set currentPath on the request (as for FetchPath), a success with childrenCount === 0 never rolls it back. You’d leave the navigator on a path it was never supposed to take — the opposite of “conditionally.”

@coderabbitai

coderabbitai Bot commented Aug 3, 2026

Copy link
Copy Markdown

Tip

For best results, initiate chat on the files or code changes.

@jvega190 You are correct. conditionallySetPath must not update currentPath when it starts the request. It commits the candidate path only when the response succeeds and parent.childrenCount > 0.

I withdraw the outside-diff-range comment.

🐇


✏️ Learnings added
Learnt from: jvega190
URL: https://github.com/craftersoftware/craftercms/pull/8858

Timestamp: 2026-08-03T17:53:56.355Z
Learning: In `studio-ui/ui/app/src/state/reducers/pathNavigator.ts`, `pathNavigatorFetchPath` represents committed navigation and can update `currentPath` when the request starts. `conditionallySetPath` probes a candidate path and must update `currentPath` only after a successful response where `parent.childrenCount > 0`; updating it on request would retain a candidate path when the response has no children.

Note: Learnings are effective only in the context of similar code segments. To apply general coding guidelines, please configure review instructions. You can manage existing learnings in the app.

You are interacting with an AI system.

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