Skip to content

[_]: fix/reset the anchor Id when navigating through folders#68

Merged
xabg2 merged 2 commits into
masterfrom
fix/folder-navigation
Jun 29, 2026
Merged

[_]: fix/reset the anchor Id when navigating through folders#68
xabg2 merged 2 commits into
masterfrom
fix/folder-navigation

Conversation

@xabg2

@xabg2 xabg2 commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

Reseting the anchor Id when navigating through folders. It was causing problems because fetching folders with the wrong anchor ID was throwing a 500 error.

@xabg2 xabg2 requested a review from jzunigax2 June 29, 2026 11:46
@xabg2 xabg2 self-assigned this Jun 29, 2026
@xabg2 xabg2 added the enhancement New feature or request label Jun 29, 2026
@coderabbitai

coderabbitai Bot commented Jun 29, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 112c6ce3-469b-4b92-92c5-a128e767042a

📥 Commits

Reviewing files that changed from the base of the PR and between 999e56e and 3577f9d.

📒 Files selected for processing (1)
  • src/hooks/mail/useListFolderPaginated.ts

📝 Walkthrough

Walkthrough

Adds a new exported constant AUTO_POLLING_INTERVAL_IN_MILLISECONDS set to 30000. Updates useListFolderPaginated to track currentMailbox in local state and reset anchorId and unreadFilter when the mailbox prop changes; also replaces the hardcoded 30000 polling interval with the new constant.

Changes

Mailbox Reset and Polling Constant

Layer / File(s) Summary
Polling constant and mailbox-change reset
src/constants.ts, src/hooks/mail/useListFolderPaginated.ts
Exports AUTO_POLLING_INTERVAL_IN_MILLISECONDS = 30000; hook adds currentMailbox state to detect when the mailbox prop changes and resets anchorId and unreadFilter accordingly; replaces hardcoded 30000 with the named constant for pollingInterval; reorders returned fields.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Suggested reviewers

  • larryrider
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly reflects the main change: resetting the anchor ID when navigating folders.
Description check ✅ Passed The description is directly related to the change and explains the wrong anchor ID issue it fixes.
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 docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/folder-navigation

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

ESLint install failed: one or more packages not found in the registry.


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

Choose a reason for hiding this comment

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

Warning

CodeRabbit couldn't request changes on this pull request because it doesn't have sufficient GitHub permissions.

Please grant CodeRabbit Pull requests: Read and write permission and re-run the review.

👉 Steps to fix this

Actionable comments posted: 2

🤖 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 `@src/features/mail/MailView.tsx`:
- Around line 55-58: The folder-change reset in MailView is happening too late,
after useListFolderPaginated(folder) has already derived query args with stale
anchorId/unreadFilter. Move this logic out of the MailView useEffect and into
the list-fetching hook path, such as useListFolderPaginated or its query-arg/key
derivation, so changing folder clears or rekeys the query before
useGetListFolderQuery runs. Keep MailView dumb and rendering only, and ensure
the reset behavior is driven by the hook’s state/inputs rather than an
imperative post-render effect.

In `@src/hooks/mail/useListFolderPaginated.ts`:
- Around line 43-58: The new reset behavior in useListFolderPaginated needs
co-located test coverage, and the missing useListFolderPaginated.test.ts should
verify that resetListFolder clears both anchorId and unreadFilter. Add a focused
hook test around useListFolderPaginated that exercises the resetListFolder
callback and asserts the state is fully reset, matching the existing hook’s
reset logic and protecting the folder-navigation flow regression.
🪄 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: ASSERTIVE

Plan: Pro

Run ID: f801286e-00b4-4e10-8e36-e2c1ed2523bb

📥 Commits

Reviewing files that changed from the base of the PR and between 6984449 and 999e56e.

📒 Files selected for processing (3)
  • src/constants.ts
  • src/features/mail/MailView.tsx
  • src/hooks/mail/useListFolderPaginated.ts

Comment thread src/features/mail/MailView.tsx Outdated
Comment thread src/hooks/mail/useListFolderPaginated.ts Outdated
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Jun 29, 2026

Copy link
Copy Markdown

Deploying mail-web with  Cloudflare Pages  Cloudflare Pages

Latest commit: 3577f9d
Status: ✅  Deploy successful!
Preview URL: https://c81af2f6.mail-web-ea0.pages.dev
Branch Preview URL: https://fix-folder-navigation.mail-web-ea0.pages.dev

View logs

@sonarqubecloud

Copy link
Copy Markdown

@xabg2 xabg2 merged commit a4a0e09 into master Jun 29, 2026
6 checks passed
@xabg2 xabg2 deleted the fix/folder-navigation branch June 29, 2026 13:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant