-
Notifications
You must be signed in to change notification settings - Fork 7
ENG-2167 nodeSchemaToCrossApp is missing modifiedAt #1335
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -185,20 +185,25 @@ export const nodeSchemaToCrossApp = ( | |||||
| s: DiscourseNode, | ||||||
| ): CrossAppNodeSchema | null => { | ||||||
| const relData = window.roamAlphaAPI.pull( | ||||||
| "[:create/time :edit/time {:create/user [:user/uid]}]", | ||||||
| "[:create/time :page/edit-time {:create/user [:user/uid]}]", | ||||||
| `[:block/uid "${s.type}"]`, | ||||||
| ) as unknown as { | ||||||
| ":create/time": number; | ||||||
| ":edit/time": number; | ||||||
| ":page/edit-time"?: number; | ||||||
| ":create/user": { ":user/uid": string }; | ||||||
| }; | ||||||
| if (!relData) return null; | ||||||
| const userUid = (relData[":create/user"] ?? {})[":user/uid"]; | ||||||
| if (!userUid) return null; | ||||||
| const createdTime = relData[":create/time"] || Date.now(); | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Inconsistent operator usage creates a bug with timestamp value Fix: const createdTime = relData[":create/time"] ?? Date.now();This ensures only
Suggested change
Spotted by Graphite |
||||||
| // A node type's settings live either in the page's props or in blocks below it, | ||||||
| // but :page/edit-time reflects both. | ||||||
| const pageEditTime = relData[":page/edit-time"] || createdTime; | ||||||
| return { | ||||||
| localId: s.type, | ||||||
| label: s.text, | ||||||
| authorId: userUid, | ||||||
| createdAt: new Date(relData[":create/time"] || Date.now()), | ||||||
| createdAt: new Date(createdTime), | ||||||
| modifiedAt: new Date(Math.max(pageEditTime, createdTime)), | ||||||
| }; | ||||||
| }; | ||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does
:page/edit-timenot track both blocks+page edit time?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It does. cc @maparent