mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-03-21 17:09:09 +01:00
Fix active workspace deletion
This commit is contained in:
@@ -18,8 +18,6 @@ export function useRecentWorkspaces() {
|
||||
[value, workspaces],
|
||||
);
|
||||
|
||||
|
||||
console.log("HELLO", {isLoading, value})
|
||||
if (isLoading) return null;
|
||||
|
||||
return onlyValidIds;
|
||||
@@ -29,18 +27,15 @@ export function useSubscribeRecentWorkspaces() {
|
||||
useEffect(() => {
|
||||
return jotaiStore.sub(activeWorkspaceIdAtom, async () => {
|
||||
const activeWorkspaceId = jotaiStore.get(activeWorkspaceIdAtom);
|
||||
console.log("AAA");
|
||||
if (activeWorkspaceId == null) return;
|
||||
|
||||
const key = kvKey();
|
||||
|
||||
const recentIds = await getKeyValue<string[]>({ namespace, key, fallback });
|
||||
console.log("BBB", recentIds, activeWorkspaceId);
|
||||
if (recentIds[0] === activeWorkspaceId) return; // Short-circuit
|
||||
|
||||
const withoutActiveId = recentIds.filter((id) => id !== activeWorkspaceId);
|
||||
const value = [activeWorkspaceId, ...withoutActiveId];
|
||||
console.log("SET ACTIVE WORCENT", value);
|
||||
await setKeyValue({ namespace, key, value });
|
||||
});
|
||||
}, []);
|
||||
|
||||
Reference in New Issue
Block a user