Files
new-api/web
Apple\Apple 07ffc36678 perf: Optimize message persistence and reduce localStorage operations
- Refactor message saving strategy from automatic to manual saving
  - Save messages only on key operations: send, complete, edit, delete, role toggle, clear
  - Prevent frequent localStorage writes during streaming responses

- Remove excessive console logging
  - Remove all console.log statements from save/load operations
  - Clean up debug logs to reduce console noise

- Optimize initial state loading with lazy initialization
  - Replace useRef with useState lazy initialization for config and messages
  - Ensure loadConfig and loadMessages are called only once on mount
  - Prevent redundant localStorage reads during re-renders

- Update hooks to support new save strategy
  - Pass saveMessages callback through component hierarchy
  - Add saveMessagesImmediately to relevant hooks (useApiRequest, useMessageActions, useMessageEdit)
  - Trigger saves at appropriate lifecycle points

This significantly improves performance by reducing localStorage I/O operations
from continuous writes during streaming to discrete saves at meaningful points.
2025-06-02 21:21:46 +08:00
..
2025-05-20 23:21:48 +08:00
2023-04-22 20:39:27 +08:00
2025-04-04 17:37:27 +08:00
2025-04-04 17:37:27 +08:00
2025-05-06 01:36:23 +08:00
2024-03-23 21:24:39 +08:00
2025-05-06 01:36:23 +08:00
2023-04-22 20:39:27 +08:00
2025-05-06 01:36:23 +08:00

React Template

Basic Usages

# Runs the app in the development mode
npm start

# Builds the app for production to the `build` folder
npm run build

If you want to change the default server, please set REACT_APP_SERVER environment variables before build, for example: REACT_APP_SERVER=http://your.domain.com.

Before you start editing, make sure your Actions on Save options have Optimize imports & Run Prettier enabled.

Reference

  1. https://github.com/OIerDb-ng/OIerDb
  2. https://github.com/cornflourblue/react-hooks-redux-registration-login-example