Skip to content

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

Merged
rohan-pandeyy merged 7 commits into
AOSSIE-Org:mainfrom
Prince-ES:fix-1416-duplicate-folder-error-dialog
Aug 3, 2026
Merged

fix: show error dialog for duplicate folder addition#1427
rohan-pandeyy merged 7 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 experience with clearer success and error messages.
    • Refined mutation feedback for pending, successful, and failed operations.
    • Updated retry behavior to avoid retrying conflict errors while continuing to retry other recoverable failures.

@coderabbitai

coderabbitai Bot commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

Walkthrough

usePictoMutation now avoids retrying Axios 409 conflicts. useFolder now uses user-facing mutation feedback for folder creation.

Changes

Mutation behavior

Layer / File(s) Summary
Mutation retry policy
frontend/src/hooks/useQueryExtension.ts, frontend/jest.setup.ts
Retry logic stops retries for Axios 409 responses and allows up to two retries for other errors. The Axios Jest mock now supports isAxiosError.
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: g-k-s-03

Poem

A rabbit checks each folder twice,
Then stops on conflicts, clear and precise.
Success and errors now appear,
No silent logs remain to hear.
Hop, hop—the feedback is here!

🚥 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 describes the main change: showing an error dialog when a duplicate folder is added.
Linked Issues check ✅ Passed The changes display mutation feedback for duplicate-folder errors and prevent retries for 409 conflicts, satisfying issue #1416.
Out of Scope Changes check ✅ Passed All changes support duplicate-folder error handling, mutation feedback, retry behavior, or its Jest mock.
✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
  • Create stacked PR
  • Commit on current branch
🧪 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

@rohan-pandeyy rohan-pandeyy left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM!

@Prince-ES

Copy link
Copy Markdown
Contributor Author

@rohan-pandeyy I updated my branch with the latest main, fixed the failing frontend tests, and all tests pass locally (31/31 suites, 288/288 tests). The remaining failing "Lint Check / Linting (pull_request_target)" workflow appears to fail during actions/checkout with:

Refusing to check out fork pull request code from a 'pull_request_target' workflow

It doesn't reach the linting step, so this looks like a workflow configuration issue rather than a lint error in the PR.

@rohan-pandeyy

Copy link
Copy Markdown
Member

@Prince-ES Pls pull the latest changes, it should fix the lint error

@rohan-pandeyy
rohan-pandeyy merged commit 48cc33b into AOSSIE-Org:main Aug 3, 2026
11 checks passed
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