Skip to content

feat(frontend): refactor state managers to centralize localStorage sync and add ErrorBoundary (#639)#650

Open
harshitanagpal05 wants to merge 5 commits into
ritesh-1918:gssocfrom
harshitanagpal05:feature/state-persistence-error-boundaries
Open

feat(frontend): refactor state managers to centralize localStorage sync and add ErrorBoundary (#639)#650
harshitanagpal05 wants to merge 5 commits into
ritesh-1918:gssocfrom
harshitanagpal05:feature/state-persistence-error-boundaries

Conversation

@harshitanagpal05
Copy link
Copy Markdown
Contributor

Description

This PR implements a centralized state persistence engine and a robust error-handling layer across the frontend architecture to satisfy the requirements of issue #639:

  1. Centralized Safe Persistence Layer (safePersistStorage):
    • Wraps the primary Zustand store hooks (authStore, adminStore, and ticketStore) in a robust storage wrapper.
    • Prevents unhandled execution blocks under Safari Private Browsing mode and disabled cookie environments.
    • Automatically handles QuotaExceededError write exceptions by falling back transparently to a transient in-memory store.
    • Dispatches a custom window-level persistent-storage-error event to track persistence health.
  2. Premium React Error Boundary (ErrorBoundary):
    • Implements a modern class-based React component enclosing the root UI shell.
    • Displays a dark-themed glassmorphic error layout with subtle gradients and background orbs to match the application aesthetic.
    • Integrates an interactive "Copy Diagnostics Payload" button allowing users to easily export formatted JSON error details (error messages, complete stack trace, React component path hierarchy, user agent, URL, and timestamp).
    • Features a clean "Recover & Restart" action to flush transient issues and re-synchronize the client.
  3. Linter & Code Quality Cleanups:
    • Removed dead, unused search state variables and handlers in AdminHeader.jsx to resolve static analysis alerts.

Related Issue

Fixes #639

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Configuration change

Checklist

  • My code follows the project's coding style
  • I have performed a self-review of my code
  • I have commented my code where necessary
  • I have updated the documentation accordingly
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or my feature works
  • New and existing unit tests pass locally with my changes

Additional Notes

@vercel
Copy link
Copy Markdown

vercel Bot commented May 29, 2026

@harshitanagpal05 is attempting to deploy a commit to the ritesh Team on Vercel.

A member of the Team first needs to authorize it.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 29, 2026

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: fdfda3d3-0cc0-4f61-9e3d-ce5ecfdb768b

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ 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 and usage tips.

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