[PR #4759] [MERGED] Refactor frontend legacy JSON.parse with safeJsonParse #4753

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

📋 Pull Request Information

Original PR: https://github.com/Mintplex-Labs/anything-llm/pull/4759
Author: @shatfield4
Created: 12/10/2025
Status: Merged
Merged: 12/11/2025
Merged by: @timothycarambat

Base: masterHead: 4758-feat-remove-all-jsonparse-and-replace-with-safejsonparse-util


📝 Commits (9)

  • 6d1cb3c replace all frontend legacy JSON.parse with safeJsonParse
  • 900e307 Merge branch 'master' into 4758-feat-remove-all-jsonparse-and-replace-with-safejsonparse-util
  • 9c05c48 default collapsed sidebar menu on failed parse
  • 9acf349 remove extra check on conditional render
  • 765695f Merge branch 'master' into 4758-feat-remove-all-jsonparse-and-replace-with-safejsonparse-util
  • 21f67ba Merge branch 'master' into 4758-feat-remove-all-jsonparse-and-replace-with-safejsonparse-util
  • 450aeed undo singular json parse
  • 8904bf2 add guard clause and return null for userFromStorage
  • 563b2b5 patch domainList

📊 Changes

11 files changed (+39 additions, -50 deletions)

View changed files

📝 frontend/src/components/SettingsSidebar/MenuOption/index.jsx (+2 -1)
📝 frontend/src/components/UserMenu/AccountModal/index.jsx (+2 -1)
📝 frontend/src/models/appearance.js (+3 -6)
📝 frontend/src/models/workspace.js (+2 -4)
📝 frontend/src/models/workspaceThread.js (+3 -5)
📝 frontend/src/pages/Admin/Logging/LogRow/index.jsx (+4 -5)
📝 frontend/src/pages/GeneralSettings/ChatEmbedWidgets/EmbedConfigs/EmbedRow/EditEmbedModal/index.jsx (+2 -3)
📝 frontend/src/pages/GeneralSettings/ChatEmbedWidgets/EmbedConfigs/EmbedRow/index.jsx (+14 -17)
📝 frontend/src/pages/GeneralSettings/CommunityHub/Trending/HubItems/HubItemCard/agentFlow.jsx (+2 -1)
📝 frontend/src/pages/Main/Home/Checklist/ChecklistItem/index.jsx (+1 -1)
📝 frontend/src/utils/request.js (+4 -6)

📄 Description

Pull Request Type

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

Relevant Issues

resolves #4758

What is in this change?

  • Refactors every instance of JSON.parse in the frontend to use safeJSONParse
  • Includes a fallback to the specific conditions sensible failover value
  • Prevents failed JSON.parse calls from throwing errors and causing the entire frontend to crash

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/4759 **Author:** [@shatfield4](https://github.com/shatfield4) **Created:** 12/10/2025 **Status:** ✅ Merged **Merged:** 12/11/2025 **Merged by:** [@timothycarambat](https://github.com/timothycarambat) **Base:** `master` ← **Head:** `4758-feat-remove-all-jsonparse-and-replace-with-safejsonparse-util` --- ### 📝 Commits (9) - [`6d1cb3c`](https://github.com/Mintplex-Labs/anything-llm/commit/6d1cb3c6b651d59345b278b56a03c095544c2ff6) replace all frontend legacy JSON.parse with safeJsonParse - [`900e307`](https://github.com/Mintplex-Labs/anything-llm/commit/900e30785c68f2533554e35f380ead467e1e86c9) Merge branch 'master' into 4758-feat-remove-all-jsonparse-and-replace-with-safejsonparse-util - [`9c05c48`](https://github.com/Mintplex-Labs/anything-llm/commit/9c05c4878e17b609c66a2615adc8c780da071772) default collapsed sidebar menu on failed parse - [`9acf349`](https://github.com/Mintplex-Labs/anything-llm/commit/9acf3496a59f9cbb3dc28fc10e9546eb8ba6e402) remove extra check on conditional render - [`765695f`](https://github.com/Mintplex-Labs/anything-llm/commit/765695fba1c1e07569df165fcf11de7d8e8d904f) Merge branch 'master' into 4758-feat-remove-all-jsonparse-and-replace-with-safejsonparse-util - [`21f67ba`](https://github.com/Mintplex-Labs/anything-llm/commit/21f67bac371ed3937ba30d19a8910890b94f8089) Merge branch 'master' into 4758-feat-remove-all-jsonparse-and-replace-with-safejsonparse-util - [`450aeed`](https://github.com/Mintplex-Labs/anything-llm/commit/450aeedfb9723bcad7de169b08ce2dbd8f9347ee) undo singular json parse - [`8904bf2`](https://github.com/Mintplex-Labs/anything-llm/commit/8904bf24f8e1aaa6d5297de7832f6b69320619ad) add guard clause and return null for `userFromStorage` - [`563b2b5`](https://github.com/Mintplex-Labs/anything-llm/commit/563b2b58daf90e162e5af827eb311ea809203f50) patch domainList ### 📊 Changes **11 files changed** (+39 additions, -50 deletions) <details> <summary>View changed files</summary> 📝 `frontend/src/components/SettingsSidebar/MenuOption/index.jsx` (+2 -1) 📝 `frontend/src/components/UserMenu/AccountModal/index.jsx` (+2 -1) 📝 `frontend/src/models/appearance.js` (+3 -6) 📝 `frontend/src/models/workspace.js` (+2 -4) 📝 `frontend/src/models/workspaceThread.js` (+3 -5) 📝 `frontend/src/pages/Admin/Logging/LogRow/index.jsx` (+4 -5) 📝 `frontend/src/pages/GeneralSettings/ChatEmbedWidgets/EmbedConfigs/EmbedRow/EditEmbedModal/index.jsx` (+2 -3) 📝 `frontend/src/pages/GeneralSettings/ChatEmbedWidgets/EmbedConfigs/EmbedRow/index.jsx` (+14 -17) 📝 `frontend/src/pages/GeneralSettings/CommunityHub/Trending/HubItems/HubItemCard/agentFlow.jsx` (+2 -1) 📝 `frontend/src/pages/Main/Home/Checklist/ChecklistItem/index.jsx` (+1 -1) 📝 `frontend/src/utils/request.js` (+4 -6) </details> ### 📄 Description ### Pull Request Type <!-- For change type, change [ ] to [x]. --> - [ ] ✨ feat - [ ] 🐛 fix - [x] ♻️ refactor - [ ] 💄 style - [ ] 🔨 chore - [ ] 📝 docs ### Relevant Issues <!-- Use "resolves #xxx" to auto resolve on merge. Otherwise, please use "connect #xxx" --> resolves #4758 ### What is in this change? <!-- Describe the changes in this PR that are impactful to the repo. --> - Refactors every instance of JSON.parse in the frontend to use safeJSONParse - Includes a fallback to the specific conditions sensible failover value - Prevents failed JSON.parse calls from throwing errors and causing the entire frontend to crash ### 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 - [x] 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:28 -05:00
yindo closed this issue 2026-02-22 18:36:28 -05:00
yindo changed title from [PR #4759] Refactor frontend legacy JSON.parse with safeJsonParse to [PR #4759] [MERGED] Refactor frontend legacy JSON.parse with safeJsonParse 2026-06-05 15:20:12 -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#4753