Open-source and local-first Slack and Notion alternative that puts you in control of your data
TypeScript chatchat-applicationcrdteditorelectronknowledge-baselocal-firstnotionnotion-alternativerealtime-collaborationself-hostedslacksqliteteam-collaborationwikiyjs
Fix account and workspace redirect components
Hakan Shehu6bb9caa27fc0
diff --git a/apps/desktop/src/renderer/components/accounts/account-redirect.tsx b/apps/desktop/src/renderer/components/accounts/account-redirect.tsxindex 476735ec..6c03c6c0 100644--- a/apps/desktop/src/renderer/components/accounts/account-redirect.tsx+++ b/apps/desktop/src/renderer/components/accounts/account-redirect.tsx@@ -1,25 +1,22 @@import React from 'react';-import { useQuery } from '@/renderer/hooks/use-query';import { useNavigate } from 'react-router-dom';export const AccountRedirect = (): React.ReactNode => {const navigate = useNavigate();- const { data, isPending } = useQuery({- type: 'account_list',- });React.useEffect(() => {- if (isPending) {- return;- }-- if (data.length == 0) {- navigate('/login');- return;- }-- navigate(`/${data[0].id}`);- }, [data, isPending, navigate]);+ window.colanode+ .executeQuery({+ type: 'account_list',+ })+ .then((data) => {+ if (data.length === 0) {+ navigate('/login');+ } else {+ navigate(`/${data[0].id}`);+ }+ });+ }, [navigate]);return null;};diff --git a/apps/desktop/src/renderer/components/workspaces/workspace-redirect.tsx b/apps/desktop/src/renderer/components/workspaces/workspace-redirect.tsxindex f69a8ba3..ba007af2 100644--- a/apps/desktop/src/renderer/components/workspaces/workspace-redirect.tsx+++ b/apps/desktop/src/renderer/components/workspaces/workspace-redirect.tsx@@ -1,30 +1,26 @@import React from 'react';import { useNavigate } from 'react-router-dom';import { useAccount } from '@/renderer/contexts/account';-import { useQuery } from '@/renderer/hooks/use-query';export const WorkspaceRedirect = (): React.ReactNode => {const account = useAccount();const navigate = useNavigate();- const { data, isPending } = useQuery({- type: 'workspace_list',- accountId: account.id,- });-- const workspaces = data ?? [];React.useEffect(() => {- if (isPending) {- return;- }-- if (workspaces.length == 0) {- navigate(`/${account.id}/create`);- return;- }-- navigate(`/${account.id}/${workspaces[0].id}`);- }, [workspaces, navigate, isPending]);+ window.colanode+ .executeQuery({+ type: 'workspace_list',+ accountId: account.id,+ })+ .then((data) => {+ const workspaces = data ?? [];+ if (workspaces.length === 0) {+ navigate(`/${account.id}/create`);+ } else {+ navigate(`/${account.id}/${workspaces[0].id}`);+ }+ });+ }, [navigate]);return null;};