index.js
965 Bytes
-
🐛 fix(playground): ensure chat interface refreshes when resetting imported messages · 36a9781dWhen using the "reset messages simultaneously" option during config import, the conversation messages in the chat interface were not being properly reset, while normal conversation resets worked correctly. **Changes:** - Modified `handleConfigReset` in `usePlaygroundState.js` to clear messages before setting default examples - Added asynchronous message update to force Chat component re-render - Ensures immediate UI refresh when resetting imported conversation data **Root Cause:** The direct assignment to DEFAULT_MESSAGES didn't trigger a complete component refresh, causing the chat interface to display stale data. **Solution:** ```javascript // Before setMessage(DEFAULT_MESSAGES); // After setMessage([]); setTimeout(() => { setMessage(DEFAULT_MESSAGES); }, 0); ``` This two-step approach forces the Chat component to unmount and remount with fresh data, resolving the display inconsistency.Apple\Apple committed