Conversation
There was a problem hiding this comment.
Refactored to use jotai instead of context
There was a problem hiding this comment.
Refactored to use jotai instead of context
There was a problem hiding this comment.
Pull request overview
This PR implements a collaboration toggle feature that disables collaboration by default until explicitly enabled by the user. The implementation includes significant dependency upgrades (Turbo v1 to v2), refactoring of identity management from Context API to Jotai atoms, and a new UI for managing sharing settings.
- Upgrades Turbo from v1.10.x to v2.7.2 with corresponding configuration updates
- Refactors identity management to use Jotai atoms instead of React Context
- Adds a collaboration toggle state with UI controls in the share dialog
- Automatically enables collaboration when accessing another user's notebook
Reviewed changes
Copilot reviewed 18 out of 20 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| turbo.json | Updated configuration format from 'pipeline' to 'tasks' for Turbo v2 compatibility |
| package.json | Upgraded Turbo dependency to v2.7.2 |
| package-lock.json | Lock file updates for Turbo and eslint-config dependencies |
| packages/eslint-config/package.json | Updated eslint-config-turbo and eslint-config-prettier versions |
| apps/front-end/src/lib/local-identity.ts | Refactored to use Jotai atoms, removed localStorage logic |
| apps/front-end/src/lib/identity-provider.tsx | Simplified to use Jotai hook instead of Context API |
| apps/front-end/src/lib/collaboration/store.ts | Added isCollaborationEnabledAtom and useIsCollaborationEnabled hook |
| apps/front-end/src/lib/collaboration/hooks.ts | Updated hooks to handle collaboration disabled state |
| apps/front-end/src/lib/collaboration/StartCollaboration.tsx | Added cleanup for awareness field on unmount |
| apps/front-end/src/plugins/CollaborationPlugin.tsx | Added check to prevent rendering when collaboration is disabled |
| apps/front-end/src/components/Icons.tsx | Added LockIcon and UnlockIcon exports |
| apps/front-end/src/app/[notebookId]/layout.tsx | Converted to client component, added auto-enable logic for other users' notebooks |
| apps/front-end/src/app/[notebookId]/[noteId]/page.tsx | Minor formatting change in JSX |
| apps/front-end/src/app/Providers.tsx | Removed IdentityProvider wrapper |
| apps/front-end/src/app/Header.tsx | Converted to client component, passes notebookId to DialogCollab |
| apps/front-end/src/app/DialogCollab.tsx | Enhanced with collaboration toggle UI and state management |
| apps/front-end/drizzle/* | Removed database migration files |
| apps/collab-server/Dockerfile | Parameterized Node version, updated to 24-alpine |
Comments suppressed due to low confidence (1)
apps/front-end/src/lib/collaboration/hooks.ts:48
- The useIsSynced hook does not update when isCollaborationEnabled changes. If collaboration is enabled after initial render, isSynced will remain true even though the provider may not be synced yet. The isCollaborationEnabled should be added to the useEffect dependency array, and the logic should handle the state change dynamically.
export function useIsSynced() {
const provider = useConnection();
const [isCollaborationEnabled] = useIsCollaborationEnabled();
const [isSynced, setIsSynced] = useState(provider.isSynced || !isCollaborationEnabled);
useEffect(() => {
const onSynced = () => setIsSynced(true);
provider.on("sync", onSynced);
return () => {
provider.off("sync", onSynced);
};
}, [provider]);
return isSynced;
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
de5141e to
c28a312
Compare
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
c28a312 to
c077e0d
Compare
* chore: Update turbo * feat: sharing toggle (#84) * feat(sharing): Toggle collaboration * Apply suggestions from code review Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Disable collaboration by default until the user enables it.