Skip to content
This repository was archived by the owner on Sep 15, 2024. It is now read-only.

Commit

Permalink
Feat [Terminal] [Chats] enhance local storage (#243)
Browse files Browse the repository at this point in the history
- [+] feat(chat.tsx): enhance local storage handling for chat input
  • Loading branch information
H0llyW00dzZ authored Feb 5, 2024
1 parent e5d28ce commit 8dcb8df
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion app/components/chat.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1265,8 +1265,12 @@ function _Chat() {
// Save the current input to local storage only if it is not a command.
// Use the captured value from the input reference.
const currentInputValue = currentInputRef?.value ?? "";
if (!currentInputValue.startsWith(ChatCommandPrefix)) {
// Save the input to local storage only if it's not empty and not a command.
if (currentInputValue && !currentInputValue.startsWith(ChatCommandPrefix)) {
localStorage.setItem(key, currentInputValue);
} else {
// If there's no value, ensure we don't create an empty key in local storage.
localStorage.removeItem(key);
}
};
// The effect should depend on the session ID to ensure it runs when the session changes.
Expand Down

0 comments on commit 8dcb8df

Please sign in to comment.