Skip to content

fix(web,desktop): navigation error recovery and release build init#166

Merged
FSM1 merged 2 commits into
mainfrom
fix/navigate-back-on-load-failure
Feb 19, 2026
Merged

fix(web,desktop): navigation error recovery and release build init#166
FSM1 merged 2 commits into
mainfrom
fix/navigate-back-on-load-failure

Conversation

@FSM1

@FSM1 FSM1 commented Feb 19, 2026

Copy link
Copy Markdown
Owner

Summary

  • Web: navigate back to parent on subfolder load failure — when navigateTo() fails to load a subfolder (IPNS timeout, decryption error), the catch block was removing the folder placeholder from the store but leaving the URL at /files/<uuid>. Now navigates back to the parent folder on failure.
  • Web: clear isLoading on error path — the catch block set latestNavTarget to the parent before the finally block ran, so setIsLoading(false) was never called, leaving the "Loading..." overlay permanently visible.
  • Desktop: fix release build stuck on "Initializing CipherBox..."get_dev_key is only registered as a Tauri command in debug builds (#[cfg(debug_assertions)]), but the JS called await invoke('get_dev_key') without try/catch. In release builds the promise rejects, silently aborting the entire init function.
  • E2E: retry logic for transient IPNS failuresnavigateIntoFolder now retries once if navigation fails (handles CI IPNS propagation delays).

Test plan

  • E2E test 3.10 passes reliably in CI
  • Desktop release build progresses past "Initializing CipherBox..." to login screen
  • Manual: navigate into subfolder when IPNS is slow — app returns to parent instead of showing empty root

🤖 Generated with Claude Code

When navigateTo() fails to load a subfolder (IPNS resolve timeout,
decryption error, etc.), the catch block was removing the folder
placeholder from the store but leaving the URL at /files/<uuid>.
This caused the app to render ~/root with an empty directory state,
breaking subsequent E2E navigation.

Now navigates back to the parent folder on failure, matching the
existing behavior pattern used elsewhere in the codebase.

Also adds retry logic to E2E navigateIntoFolder helper to handle
transient IPNS propagation delays in CI.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Feb 19, 2026

Copy link
Copy Markdown

No actionable comments were generated in the recent review. 🎉


Walkthrough

Adds recovery to folder navigation on subfolder load failures (navigates to parent or root and clears loading state) and hardens an e2e folder-navigation helper with a retry for transient CI navigation failures.

Changes

Cohort / File(s) Summary
Navigation hook (error recovery)
apps/web/src/hooks/useFolderNavigation.ts
On subfolder load error: removes loading placeholder, sets isLoading=false, updates latestNavTarget to parent (or 'root'), and navigates to /files/{parentId} or /files.
End-to-end test (retry logic)
tests/e2e/tests/full-workflow.spec.ts
navigateIntoFolder gains retry logic: attempts double-click navigation up to two times, waits for breadcrumb update between attempts, verifies folder row presence, and throws an explicit error after retries fail.

Sequence Diagram(s)

(Skipped — changes are limited to a hook and test retry; not introducing a new multi-component sequential feature that requires visualization.)

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title directly and accurately describes the main change: adding navigation back to parent folder when subfolder load fails, which is the primary purpose of the useFolderNavigation.ts modifications.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/navigate-back-on-load-failure

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 and usage tips.

@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)
apps/web/src/hooks/useFolderNavigation.ts (1)

274-284: ⚠️ Potential issue | 🔴 Critical

setIsLoading(false) is never called on the error path — loading state leaks.

Tracing the execution:

  1. setIsLoading(true) is set at line 209.
  2. The catch block runs; the guard at line 269 passes (latestNavTarget.current === targetFolderId).
  3. Line 274 mutates latestNavTarget.current to parentId ?? 'root'.
  4. Finally evaluates latestNavTarget.current === targetFolderIdfalse (ref was just overwritten).
  5. setIsLoading(false) is skipped; the loading spinner is stuck forever after any subfolder load failure.

The guard in finally is designed to avoid clearing a newer navigation's loading state — but here it incorrectly fires against the same navigation that just errored out.

🐛 Proposed fix — clear loading before mutating the ref
       useFolderStore.getState().removeFolder(targetFolderId);
+      setIsLoading(false);
       latestNavTarget.current = parentId ?? 'root';
       if (parentId) {
         navigate(`/files/${parentId}`);
       } else {
         navigate('/files');
       }
     } finally {
-      // Only clear loading if this is still the latest navigation
       if (latestNavTarget.current === targetFolderId) {
         setIsLoading(false);
       }
     }

Calling setIsLoading(false) before the ref update lets the existing finally guard still protect concurrent navigations while ensuring the failed navigation clears its own loading state.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@apps/web/src/hooks/useFolderNavigation.ts` around lines 274 - 284, The
loading state is never cleared on error because latestNavTarget.current is
overwritten before the finally guard runs; update finally in useFolderNavigation
so setIsLoading(false) is called before mutating latestNavTarget.current (or
alternatively clear loading inside the catch for the failing navigation) —
specifically, ensure setIsLoading(false) runs while latestNavTarget.current
still equals targetFolderId (referencing latestNavTarget, targetFolderId,
setIsLoading, and parentId) and then update latestNavTarget.current = parentId
?? 'root' and perform navigate; this preserves the guard against newer
navigations while preventing a leaked loading state.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Outside diff comments:
In `@apps/web/src/hooks/useFolderNavigation.ts`:
- Around line 274-284: The loading state is never cleared on error because
latestNavTarget.current is overwritten before the finally guard runs; update
finally in useFolderNavigation so setIsLoading(false) is called before mutating
latestNavTarget.current (or alternatively clear loading inside the catch for the
failing navigation) — specifically, ensure setIsLoading(false) runs while
latestNavTarget.current still equals targetFolderId (referencing
latestNavTarget, targetFolderId, setIsLoading, and parentId) and then update
latestNavTarget.current = parentId ?? 'root' and perform navigate; this
preserves the guard against newer navigations while preventing a leaked loading
state.

The catch block set latestNavTarget to the parent ID before the finally
block ran. Since finally checks `latestNavTarget === targetFolderId`,
setIsLoading(false) was never called, leaving the "Loading..." overlay
permanently visible. This prevented the file list from rendering after
navigating back to the parent, breaking the E2E retry logic.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@FSM1 FSM1 merged commit ec24fab into main Feb 19, 2026
9 checks passed
@FSM1 FSM1 changed the title fix(web): navigate back to parent on subfolder load failure fix(web,desktop): navigation error recovery and release build init Feb 20, 2026
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