Skip to content

fix: handle input history storage quota errors - #4085

Open
janniemt wants to merge 1 commit into
openBitFun:mainfrom
janniemt:fix/4059
Open

janniemt wants to merge 1 commit into
openBitFun:mainfrom
janniemt:fix/4059

Conversation

@janniemt

@janniemt janniemt commented Dec 5, 2026

Copy link
Copy Markdown

Summary

Related to #4059.

This PR prevents localStorage write exceptions from propagating through the input history store when the storage quota is exceeded.

Changes

  • Added a custom storage adapter using Zustand's createJSONStorage.
  • Added exception handling around localStorage writes.
  • Preserved input history in memory when persistence fails.
  • Added a regression test that simulates a QuotaExceededError.

The change is intentionally limited to input history persistence and does not modify existing history limits, delete stored user data, or change the user interface.

Testing

  • Regression test before the fix: Failed as expected with a QuotaExceededError.
  • Regression test after the fix: Passed.
  • Focused ESLint check: No errors in the modified implementation. The test file was ignored by the project's ESLint configuration.
  • Design system build: Passed.

Regression test command:

pnpm --dir src/web-ui run test:run src/flow_chat/store/inputHistoryStore.test.ts

Verification Limitations

The full frontend verification command (pnpm run check:web) failed because of a stale generated MiniApp chrome theme artifact.

The TypeScript check failed because the @/generated/api module could not be found.

Both errors occurred outside the files modified by this PR. I did not modify unrelated files to resolve these errors. The complete desktop message submission workflow has not been manually tested.

AI Assistance Disclosure

I used ChatGPT to help investigate the storage exception, understand Zustand persistence, develop the proposed implementation and regression test, and troubleshoot verification commands. I verified the proposed solution by running the regression test before and after implementing the fix.

Testing level: Lightly tested through focused automated regression testing and implementation linting.

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