[PR #4680] [MERGED] Store Chat Prompt Input Value in Local Storage #4712

Closed
opened 2026-02-22 18:36:23 -05:00 by yindo · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Mintplex-Labs/anything-llm/pull/4680
Author: @angelplusultra
Created: 11/24/2025
Status: Merged
Merged: 12/2/2025
Merged by: @timothycarambat

Base: masterHead: 4604-store-chat-prompt-state


📝 Commits (10+)

  • d93fda8 Add logic to save prompt input state to local storage and use as initial state on mount
  • ba44a0b Synchronize prompt input state with parent component on mount
  • 0a6094a lint
  • 86b70d7 Clear USER_PROMPT_INPUT_VALUE local storage value in all instances of auth clearing
  • 898d9de Remove USER_PROMPT_INPUT_VALUE local storage removeItem logic from excessive sources
  • 1da8003 Refactor logic to cache prompt input value state by thread | abstract into a custom hook | rename localStorage key variables for clarity.
  • b1b46ba Remove console log statement from usePromptInputStorage hook to clean up code.
  • 04281c0 Update comments in usePromptInputStorage hook for clarity on localStorage handling
  • 4228c6b Implement debounced localStorage updates in usePromptInputStorage hook to improve performance and prevent writing on every keystroke.
  • ecf7c54 Refactor localStorage handling in usePromptInputStorage hook to utilize safeJsonParse | Remove uneeeded comments

📊 Changes

5 files changed (+89 additions, -1 deletions)

View changed files

📝 frontend/src/AuthContext.jsx (+7 -1)
📝 frontend/src/components/UserMenu/UserButton/index.jsx (+2 -0)
📝 frontend/src/components/WorkspaceChat/ChatContainer/PromptInput/index.jsx (+8 -0)
frontend/src/hooks/usePromptInputStorage.js (+71 -0)
📝 frontend/src/utils/constants.js (+1 -0)

📄 Description

Pull Request Type

  • feat
  • 🐛 fix
  • ♻️ refactor
  • 💄 style
  • 🔨 chore
  • 📝 docs

Relevant Issues

resolves #4604

What is in this change?

This PR implements a small feature to save the state of the workspace chat input value in local storage and will be applied as the initial state for all workspace chats if truthy. It also clears this value when in multi-user mode and the current users signs out. It also clears this value in every other auth clearing situation.

Additional Information

Developer Validations

  • I ran yarn lint from the root of the repo & committed changes
  • Relevant documentation has been updated
  • I have tested my code functionality
  • Docker build succeeds locally

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Mintplex-Labs/anything-llm/pull/4680 **Author:** [@angelplusultra](https://github.com/angelplusultra) **Created:** 11/24/2025 **Status:** ✅ Merged **Merged:** 12/2/2025 **Merged by:** [@timothycarambat](https://github.com/timothycarambat) **Base:** `master` ← **Head:** `4604-store-chat-prompt-state` --- ### 📝 Commits (10+) - [`d93fda8`](https://github.com/Mintplex-Labs/anything-llm/commit/d93fda8f97559a733b9748e7933ef03dcf92bd4f) Add logic to save prompt input state to local storage and use as initial state on mount - [`ba44a0b`](https://github.com/Mintplex-Labs/anything-llm/commit/ba44a0bc1be6c0bfd2b3b87c5613c35d46a07fbc) Synchronize prompt input state with parent component on mount - [`0a6094a`](https://github.com/Mintplex-Labs/anything-llm/commit/0a6094a49b9784cd850b8bfef677a28e90ed39ff) lint - [`86b70d7`](https://github.com/Mintplex-Labs/anything-llm/commit/86b70d75101deada5958a060960a83b4bc83b3ff) Clear USER_PROMPT_INPUT_VALUE local storage value in all instances of auth clearing - [`898d9de`](https://github.com/Mintplex-Labs/anything-llm/commit/898d9deae09e9142110894d4f8989f79dfe95697) Remove USER_PROMPT_INPUT_VALUE local storage `removeItem` logic from excessive sources - [`1da8003`](https://github.com/Mintplex-Labs/anything-llm/commit/1da80037fa95c89620889acb0063a8fff180ad39) Refactor logic to cache prompt input value state by thread | abstract into a custom hook | rename localStorage key variables for clarity. - [`b1b46ba`](https://github.com/Mintplex-Labs/anything-llm/commit/b1b46baf43ab4f9adb126418b61d1106ab6c152b) Remove console log statement from usePromptInputStorage hook to clean up code. - [`04281c0`](https://github.com/Mintplex-Labs/anything-llm/commit/04281c0a15f3330488a5fd347dc25631a972370f) Update comments in usePromptInputStorage hook for clarity on localStorage handling - [`4228c6b`](https://github.com/Mintplex-Labs/anything-llm/commit/4228c6b3b0c73ada76459775743b0dce3e30d3fc) Implement debounced localStorage updates in usePromptInputStorage hook to improve performance and prevent writing on every keystroke. - [`ecf7c54`](https://github.com/Mintplex-Labs/anything-llm/commit/ecf7c542779ce2c1d867b9474a472dffa3b33524) Refactor localStorage handling in usePromptInputStorage hook to utilize safeJsonParse | Remove uneeeded comments ### 📊 Changes **5 files changed** (+89 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `frontend/src/AuthContext.jsx` (+7 -1) 📝 `frontend/src/components/UserMenu/UserButton/index.jsx` (+2 -0) 📝 `frontend/src/components/WorkspaceChat/ChatContainer/PromptInput/index.jsx` (+8 -0) ➕ `frontend/src/hooks/usePromptInputStorage.js` (+71 -0) 📝 `frontend/src/utils/constants.js` (+1 -0) </details> ### 📄 Description ### Pull Request Type <!-- For change type, change [ ] to [x]. --> - [x] ✨ feat - [ ] 🐛 fix - [ ] ♻️ refactor - [ ] 💄 style - [ ] 🔨 chore - [ ] 📝 docs ### Relevant Issues <!-- Use "resolves #xxx" to auto resolve on merge. Otherwise, please use "connect #xxx" --> resolves #4604 ### What is in this change? <!-- Describe the changes in this PR that are impactful to the repo. --> This PR implements a small feature to save the state of the workspace chat input value in local storage and will be applied as the initial state for all workspace chats if truthy. It also clears this value when in multi-user mode and the current users signs out. It also clears this value in every other auth clearing situation. ### Additional Information <!-- Add any other context about the Pull Request here that was not captured above. --> ### Developer Validations <!-- All of the applicable items should be checked. --> - [x] I ran `yarn lint` from the root of the repo & committed changes - [x] Relevant documentation has been updated - [x] I have tested my code functionality - [ ] Docker build succeeds locally --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
yindo added the pull-request label 2026-02-22 18:36:23 -05:00
yindo closed this issue 2026-02-22 18:36:23 -05:00
yindo changed title from [PR #4680] Store Chat Prompt Input Value in Local Storage to [PR #4680] [MERGED] Store Chat Prompt Input Value in Local Storage 2026-06-05 15:19:59 -04:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Mintplex-Labs/anything-llm#4712