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
31 changes: 20 additions & 11 deletions src/common/stores/workspace-id-store.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { create } from 'zustand';
import { devtools } from 'zustand/middleware';
import { createJSONStorage, devtools, persist } from 'zustand/middleware';
import { immer } from 'zustand/middleware/immer';

export interface WorkspaceStoreState {
Expand All @@ -10,16 +10,25 @@ export interface WorkspaceStoreState {
}

const workspaceStore = create<WorkspaceStoreState>()(
devtools(
immer((set) => ({
workspaceId: '',
actions: {
setWorkspaceId: (workspaceId: string) =>
set((state) => {
state.workspaceId = workspaceId;
}),
},
})),
persist(
devtools(
immer((set) => ({
workspaceId: '',
actions: {
setWorkspaceId: (workspaceId: string) =>
set((state) => {
state.workspaceId = workspaceId;
}),
},
})),
),
{
name: 'workspaceid-storage', // sessionStorage에 저장될 때 사용될 key 이름
storage: createJSONStorage(() => sessionStorage), // localStorage 대신 sessionStorage 사용
partialize: (state) => ({
workspaceId: state.workspaceId,
}),
},
),
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,12 @@ const InstagramCallBackClient = () => {
const { workspaceId } = useWorkspaceIdStore();
const { showOnboardingToast } = useOnboardingToastActions();
const { mutate: linkInstagram } = useLinkInstagramMutation();

useEffect(() => {
// ✅ 1. workspaceId가 아직 복원되지 않았다면, 아무것도 하지 않고 실행을 종료
// 상태가 복원되어 workspaceId가 생기면, 이 useEffect는 다시 실행됩니다.
if (!workspaceId) {
console.error('workspaceId 없음');
return;
}

Copy link

Copilot AI Aug 21, 2025

Choose a reason for hiding this comment

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

[P3] 프로덕션 코드에 디버깅용 console.error가 남아있습니다. 개발 중 디버깅이 완료되면 이 로그를 제거하거나, 필요하다면 적절한 로깅 라이브러리를 사용하는 것을 권장합니다.

Suggested change
return;
}

Copilot uses AI. Check for mistakes.
Expand Down