Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 0 additions & 9 deletions apps/desktop/src/lib/trpc/routers/projects/projects.ts
Original file line number Diff line number Diff line change
Expand Up @@ -330,15 +330,6 @@ export const createProjectsRouter = (getWindow: () => BrowserWindow | null) => {
return resolveDefaultEditor(input.projectId);
}),

hasAny: publicProcedure.query(() => {
const row = localDb
.select({ id: projects.id })
.from(projects)
.limit(1)
.all();
return row.length > 0;
}),

getRecents: publicProcedure.query((): Project[] => {
return localDb
.select()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,15 +95,6 @@ export const createQueryProcedures = () => {
.sort((a, b) => a.tabOrder - b.tabOrder);
}),

hasAny: publicProcedure.query(() => {
const row = localDb
.select({ id: workspaces.id })
.from(workspaces)
.limit(1)
.all();
return row.length > 0;
}),

getAllGrouped: publicProcedure.query(() => {
type WorkspaceItem = {
id: string;
Expand Down

This file was deleted.

This file was deleted.

6 changes: 0 additions & 6 deletions apps/desktop/src/renderer/hooks/useIsFreshInstall.ts

This file was deleted.

2 changes: 0 additions & 2 deletions apps/desktop/src/renderer/routes/-layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { PostHogSurfaceTagger } from "renderer/components/PostHogSurfaceTagger";
import { PostHogUserIdentifier } from "renderer/components/PostHogUserIdentifier";
import { TelemetrySync } from "renderer/components/TelemetrySync";
import { ThemedToaster } from "renderer/components/ThemedToaster";
import { V2DefaultResolver } from "renderer/components/V2DefaultResolver";
import { AuthProvider } from "renderer/providers/AuthProvider";
import { ElectronTRPCProvider } from "renderer/providers/ElectronTRPCProvider";
import { PostHogProvider } from "renderer/providers/PostHogProvider";
Expand All @@ -13,7 +12,6 @@ export function RootLayout({ children }: { children: ReactNode }) {
return (
<PostHogProvider>
<ElectronTRPCProvider>
<V2DefaultResolver />
<PostHogUserIdentifier />
<PostHogSurfaceTagger />
<TelemetrySync />
Expand Down
20 changes: 0 additions & 20 deletions apps/desktop/src/renderer/routes/_authenticated/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import { NewWorkspaceModal } from "renderer/components/NewWorkspaceModal";
import { Paywall } from "renderer/components/Paywall";
import { useUpdateListener } from "renderer/components/UpdateToast";
import { env } from "renderer/env.renderer";
import { useIsFreshInstall } from "renderer/hooks/useIsFreshInstall";
import { useIsV2CloudEnabled } from "renderer/hooks/useIsV2CloudEnabled";
import { useOnlineStatus } from "renderer/hooks/useOnlineStatus";
import { authClient, getAuthToken } from "renderer/lib/auth-client";
Expand All @@ -26,12 +25,6 @@ import { InitGitDialog } from "renderer/react-query/projects/InitGitDialog";
import { DashboardNewWorkspaceModal } from "renderer/routes/_authenticated/components/DashboardNewWorkspaceModal";
import { V1ImportModal } from "renderer/routes/_authenticated/components/V1ImportModal";
import { WorkspaceInitEffects } from "renderer/screens/main/components/WorkspaceInitEffects";
import {
STEP_ROUTES,
selectFirstIncompleteStep,
selectRequiredStepsComplete,
useOnboardingStore,
} from "renderer/stores/onboarding";
import { useSettingsStore } from "renderer/stores/settings-state";
import { useTabsStore } from "renderer/stores/tabs/store";
import { useAgentHookListener } from "renderer/stores/tabs/useAgentHookListener";
Expand Down Expand Up @@ -66,9 +59,6 @@ function AuthenticatedLayout() {
const utils = electronTrpc.useUtils();
const shownWorkspaceInitWarningsRef = useRef(new Set<string>());
const isV2CloudEnabled = useIsV2CloudEnabled();
const isFreshInstall = useIsFreshInstall();
const requiredComplete = useOnboardingStore(selectRequiredStepsComplete);
const firstIncompleteStep = useOnboardingStore(selectFirstIncompleteStep);

const isSignedIn = env.SKIP_ENV_VALIDATION || !!session?.user;
const activeOrganizationId = env.SKIP_ENV_VALIDATION
Expand Down Expand Up @@ -206,16 +196,6 @@ function AuthenticatedLayout() {
return <Navigate to="/create-organization" replace />;
}

const isOnSetupRoute = location.pathname.startsWith("/setup");
if (
isV2CloudEnabled &&
isFreshInstall === true &&
!requiredComplete &&
!isOnSetupRoute
) {
return <Navigate to={STEP_ROUTES[firstIncompleteStep]} replace />;
}

return (
<DndProvider manager={dragDropManager}>
<CollectionsProvider>
Expand Down
4 changes: 0 additions & 4 deletions apps/desktop/src/renderer/stores/v2-local-override.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,15 @@ import { devtools, persist } from "zustand/middleware";

interface V2LocalOverrideState {
optInV2: boolean | null;
isFreshInstall: boolean | null;
setOptInV2: (optInV2: boolean) => void;
setIsFreshInstall: (isFreshInstall: boolean) => void;
}

export const useV2LocalOverrideStore = create<V2LocalOverrideState>()(
devtools(
persist(
(set) => ({
optInV2: null,
isFreshInstall: null,
setOptInV2: (optInV2) => set({ optInV2 }),
setIsFreshInstall: (isFreshInstall) => set({ isFreshInstall }),
}),
{ name: "v2-local-override-v2" },
),
Comment on lines 11 to 17
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 The isFreshInstall field is being removed from the persisted store, but there is no version bump or migrate function to clean the orphaned key out of existing users' localStorage. Zustand's persist middleware will simply ignore the unknown isFreshInstall key on rehydration, so behaviour is correct — but the stale value will accumulate in localStorage indefinitely for anyone who ran the old build. A version bump with a trivial migration would clean it up.

Suggested change
persist(
(set) => ({
optInV2: null,
isFreshInstall: null,
setOptInV2: (optInV2) => set({ optInV2 }),
setIsFreshInstall: (isFreshInstall) => set({ isFreshInstall }),
}),
{ name: "v2-local-override-v2" },
),
persist(
(set) => ({
optInV2: null,
setOptInV2: (optInV2) => set({ optInV2 }),
}),
{
name: "v2-local-override-v2",
version: 1,
migrate: (persisted) => {
const state = persisted as Record<string, unknown>;
const { isFreshInstall: _dropped, ...rest } = state;
return rest;
},
},
),
Prompt To Fix With AI
This is a comment left during a code review.
Path: apps/desktop/src/renderer/stores/v2-local-override.ts
Line: 11-17

Comment:
The `isFreshInstall` field is being removed from the persisted store, but there is no version bump or `migrate` function to clean the orphaned key out of existing users' localStorage. Zustand's `persist` middleware will simply ignore the unknown `isFreshInstall` key on rehydration, so behaviour is correct — but the stale value will accumulate in localStorage indefinitely for anyone who ran the old build. A version bump with a trivial migration would clean it up.

```suggestion
		persist(
			(set) => ({
				optInV2: null,
				setOptInV2: (optInV2) => set({ optInV2 }),
			}),
			{
				name: "v2-local-override-v2",
				version: 1,
				migrate: (persisted) => {
					const state = persisted as Record<string, unknown>;
					const { isFreshInstall: _dropped, ...rest } = state;
					return rest;
				},
			},
		),
```

How can I resolve this? If you propose a fix, please make it concise.

Expand Down
Loading