Skip to content

Commit c077e0d

Browse files
BrianUribe6Copilot
andcommitted
Apply suggestions from code review
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1 parent 0ccc3eb commit c077e0d

File tree

6 files changed

+5
-16
lines changed

6 files changed

+5
-16
lines changed

apps/front-end/src/app/DialogCollab.tsx

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,7 @@ import { usePathname } from "next/navigation";
1717
import { useState } from "react";
1818
import { useIsCollaborationEnabled } from "@/lib/collaboration";
1919

20-
type DialogCollabProps = {
21-
notebookId: string;
22-
};
23-
24-
export default function DialogCollab({ notebookId }: DialogCollabProps) {
20+
export default function DialogCollab() {
2521
const pathname = usePathname();
2622
const fullUrl = `${getOrigin()}${pathname}`;
2723
const [isCollaborationEnabled, setIsCollaborationEnabled] = useIsCollaborationEnabled();

apps/front-end/src/app/Header.tsx

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,12 @@
11
"use client";
22

3-
import { useParams } from "next/navigation";
43
import ActiveUsers from "./ActiveUsers";
54
import BreadcrumbsShell from "./BreadcrumbsShell";
65
import DialogCollab from "./DialogCollab";
76
import MobileNavigation from "./MobileNavigation";
87
import UserProfileMenu from "./UserProfileMenu";
98

109
function Header() {
11-
const params = useParams();
12-
const notebookId = params.notebookId as string;
13-
1410
return (
1511
<header
1612
className="sticky top-0 z-10 flex items-center border-b border-gray-200 bg-white/90 p-4
@@ -20,7 +16,7 @@ function Header() {
2016
<BreadcrumbsShell />
2117
<div className="ml-auto flex items-center space-x-4">
2218
<ActiveUsers />
23-
<DialogCollab notebookId={notebookId} />
19+
<DialogCollab />
2420
<UserProfileMenu />
2521
</div>
2622
</header>

apps/front-end/src/app/[notebookId]/[noteId]/page.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { Editor } from "@/components/Editor";
33
export const dynamic = "force-dynamic";
44

55
async function NotePage({ params }: { params: { noteId: string } }) {
6-
return <Editor collaboration={{ documentId: params.noteId}} />;
6+
return <Editor collaboration={{ documentId: params.noteId }} />;
77
}
88

99
export default NotePage;

apps/front-end/src/app/[notebookId]/layout.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ function Layout({ children, params }: LayoutProps) {
2222
// Enable collaboration by default when accessing a notebook that is not your own
2323
setIsCollaborationEnabled(true);
2424
}
25-
}, []);
25+
}, [identity.id, params.notebookId, setIsCollaborationEnabled]);
2626

2727
return (
2828
<div className="grid lg:grid-cols-[20rem_auto]">

apps/front-end/src/lib/collaboration/StartCollaboration.tsx

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,6 @@ export function StartCollaboration({ notebookId }: StartCollaborationProps) {
3838
id: identity.id,
3939
name: identity.name,
4040
});
41-
return () => {
42-
provider.setAwarenessField("user", null);
43-
};
4441
}, [identity, provider]);
4542

4643
return null;

apps/front-end/src/lib/identity-provider.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@ import { useAtomValue } from "jotai";
44
import { identityAtom, LocalIdentity } from "./local-identity";
55

66
export function useLocalIdentity(): LocalIdentity {
7-
return useAtomValue(identityAtom)
7+
return useAtomValue(identityAtom);
88
}

0 commit comments

Comments
 (0)