Skip to content

fix: show error dialog for duplicate folder addition - #1427

Open
Prince-ES wants to merge 4 commits into
AOSSIE-Org:mainfrom
Prince-ES:fix-1416-duplicate-folder-error-dialog
Open

fix: show error dialog for duplicate folder addition#1427
Prince-ES wants to merge 4 commits into
AOSSIE-Org:mainfrom
Prince-ES:fix-1416-duplicate-folder-error-dialog

Conversation

@Prince-ES

@Prince-ES Prince-ES commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

Addressed Issues:

Fixes #1416

Screenshots/Recordings:

Before:

2026-07-26.06-45-23.mp4

After:

2026-07-27.21-23-27.mp4

Additional Notes:

  • Added mutation feedback handling for folder addition errors.
  • Reused the existing useMutationFeedback and showInfoDialog flow to display backend error messages consistently with the application UI.
  • Verified that duplicate folder addition now shows the appropriate error message returned by the backend.

AI Usage Disclosure:

  • This PR does not contain AI-generated code at all.
  • This PR contains AI-generated code. I have read the AI Usage Policy and this PR complies with this policy. I have tested the code locally and I am responsible for it.

I have used the following AI models and tools:

  • ChatGPT for assistance with debugging, understanding the existing mutation feedback flow, and reviewing the implementation approach.

Checklist

  • My PR addresses a single issue, fixes a single bug or makes a single improvement.
  • My code follows the project's code style and conventions.
  • If applicable, I have made corresponding changes or additions to the documentation.
  • If applicable, I have made corresponding changes or additions to tests.
  • My changes generate no new warnings or errors.
  • I have joined the Discord server and I will share a link to this PR with the project maintainers there.
  • I have read the Contribution Guidelines.
  • Once I submit my PR, CodeRabbit AI will automatically review it and I will address CodeRabbit's comments.
  • I have filled this PR template completely and carefully, and I understand that my PR may be closed without review otherwise.

Summary by CodeRabbit

  • Bug Fixes
    • Improved the add-folder user experience with clearer, user-facing success and error messaging.
    • Refined mutation feedback so pending, success, and failure states are surfaced more reliably in the UI, including proper error handling.
    • Updated mutation retry behavior to avoid retries on conflict errors (HTTP 409), while still retrying other recoverable failures.

@coderabbitai

coderabbitai Bot commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: d6d952d5-23ce-4684-ae03-ca5b9c20fa08

📥 Commits

Reviewing files that changed from the base of the PR and between 84508f3 and ab8322b.

📒 Files selected for processing (1)
  • frontend/src/hooks/useQueryExtension.ts

Walkthrough

usePictoMutation now avoids retrying Axios 409 conflicts, while useFolder replaces console logging with user-facing mutation feedback for folder creation.

Changes

Mutation behavior

Layer / File(s) Summary
Mutation retry policy
frontend/src/hooks/useQueryExtension.ts
Retry logic detects Axios 409 responses and stops retrying them; other failures retry while failureCount < 2.
Add-folder mutation feedback
frontend/src/hooks/useFolder.ts
Effect-based logging is replaced with useMutationFeedback, using mutation status and error data for explicit success and error messages.

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

Suggested labels: TypeScript/JavaScript

Suggested reviewers: sanskar-singh-2403

Poem

A bunny tuned retries just right,
So duplicate hops stop on sight.
Folder toasts now cheer or warn,
While silent logs are gently gone.
Hop, hop—the feedback’s born!

🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly matches the main change: surfacing a user-facing error for duplicate folder additions.
Linked Issues check ✅ Passed The changes address #1416 by showing feedback for 409 duplicate-folder conflicts and avoiding retries that delay the error dialog.
Out of Scope Changes check ✅ Passed The retry predicate and mutation feedback changes stay focused on duplicate-folder conflict handling and related user feedback.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (1)
frontend/src/hooks/useFolder.ts (1)

32-44: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick win

Add or verify regression coverage for mutation feedback.

Cover successful folder addition and a duplicate-folder 409 Conflict, asserting that showInfoDialog receives the backend error message.

As per path instructions, ensure critical functionality is covered by automated, comprehensive tests.

🤖 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 `@frontend/src/hooks/useFolder.ts` around lines 32 - 44, Add regression tests
for the mutation feedback flow in useFolder, covering both successful folder
addition and duplicate-folder responses with HTTP 409 Conflict. Assert that
success feedback is shown for additions and that showInfoDialog receives the
backend error message for the conflict, reusing the existing mutation and
feedback test patterns.

Source: Path instructions

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

Inline comments:
In `@frontend/src/hooks/useFolder.ts`:
- Line 4: Update the import in useFolder.ts to use the named useMutationFeedback
export from useMutationFeedback.tsx instead of a default import, while
preserving its existing usage.

---

Nitpick comments:
In `@frontend/src/hooks/useFolder.ts`:
- Around line 32-44: Add regression tests for the mutation feedback flow in
useFolder, covering both successful folder addition and duplicate-folder
responses with HTTP 409 Conflict. Assert that success feedback is shown for
additions and that showInfoDialog receives the backend error message for the
conflict, reusing the existing mutation and feedback test patterns.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 300960f0-c601-45b5-87b3-4dd317d9dcb8

📥 Commits

Reviewing files that changed from the base of the PR and between 448c0d5 and 16b4fe3.

📒 Files selected for processing (1)
  • frontend/src/hooks/useFolder.ts

Comment thread frontend/src/hooks/useFolder.ts Outdated
@rohan-pandeyy

Copy link
Copy Markdown
Member

@Prince-ES Is the long "Processing" state really necessary? Is there no better/optimized way, so it gets quicker? If not, then could we avoid blocking the entire screen while this processing is happening? It would be nice if we could use a less intrusive loading state instead of dispatching a full-screen overlay.

One more question: What happens if I add a non-duplicate folder? Does the full-screen processing overlay still appear in that case?

@Prince-ES

Prince-ES commented Jul 29, 2026

Copy link
Copy Markdown
Contributor Author

@Prince-ES Is the long "Processing" state really necessary? Is there no better/optimized way, so it gets quicker? If not, then could we avoid blocking the entire screen while this processing is happening? It would be nice if we could use a less intrusive loading state instead of dispatching a full-screen overlay.

The add-folder mutation is actually configured with retry:2 and retryDelay: 500 so, a 409 conflict is retried twice before surfacing the error. Meaning it takes 3x time + delays currently (3 requests per adding a duplicate folder).

2026-07-29.16-08-46.mp4

One more question: What happens if I add a non-duplicate folder? Does the full-screen processing overlay still appear in that case?>

Since addition of Non-duplicate folders gives a status code 200(successful request), no retries are made hence short state.
The "processing" state in last recording was also affected by my PC performance and other background processings.

So instead of retry:2 the mutation for adding a folder probably should not retry when the backend returns 409 Conflict. shall i add a commit for this?

@rohan-pandeyy

Copy link
Copy Markdown
Member

So instead of retry:2 the mutation for adding a folder probably should not retry when the backend returns 409 Conflict. shall i add a commit for this?

True, there's no need to retry if it's a conflict error. You can proceed with the commit if required.

@rohan-pandeyy

Copy link
Copy Markdown
Member

Once done, ping me in the discord server for a quicker response 😉

@Prince-ES

Copy link
Copy Markdown
Contributor Author

this is the result:-

2026-07-30.07-35-10.mp4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

BUG: Duplicate folder addition returns 409 but no user-facing error message is shown

2 participants