wip: refactor chats to use zustand
This commit is contained in:
@@ -1,14 +0,0 @@
|
||||
import { atom } from "jotai";
|
||||
import { atomWithReset } from "jotai/utils";
|
||||
|
||||
export const chatMessagesAtom = atomWithReset([]);
|
||||
export const sortedChatMessagesAtom = atom((get) => {
|
||||
const messages = get(chatMessagesAtom);
|
||||
return messages.sort(
|
||||
(x: { created_at: number }, y: { created_at: number }) =>
|
||||
x.created_at - y.created_at,
|
||||
);
|
||||
});
|
||||
|
||||
// chat content
|
||||
export const chatContentAtom = atomWithReset("");
|
||||
Reference in New Issue
Block a user