Skip to content

Commit

Permalink
ChatDrawer: sync once a minute so we don't get unexpected regroup fla…
Browse files Browse the repository at this point in the history
…shes
  • Loading branch information
enricoros committed Feb 2, 2025
1 parent 46ff3c2 commit 27ff214
Showing 1 changed file with 11 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,17 @@ export function useChatDrawerRenderItems(
searchDepth: ChatSearchDepth,
): ChatDrawerRenderItems {

// state
const [_, setJustAMinuteCounter] = React.useState(0);


// [effect] Refresh every minute because the `getTimeBucketEn` function uses the current time
React.useEffect(() => {
const interval = setInterval(() => setJustAMinuteCounter(c => c + 1), 60 * 1000);
return () => clearInterval(interval);
}, []);


const stabilizeRenderItems = React.useRef<ChatDrawerRenderItems>();

return useChatStore(({ conversations }) => {
Expand Down

0 comments on commit 27ff214

Please sign in to comment.