ENG-1865 Publish Roam stored relations for shared nodes#1221
Conversation
|
This pull request has been ignored for the connected project Preview Branches by Supabase. |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
df8bd66 to
7e9a33d
Compare
7e9a33d to
e15e0eb
Compare
e15e0eb to
9e93709
Compare
9e93709 to
123104f
Compare
123104f to
ae3123f
Compare
| Omit< | ||
| Database["public"]["CompositeTypes"]["document_local_input"], | ||
| "author_inline" | ||
| "author_inline" | "contents" |
There was a problem hiding this comment.
"content" is of type unknown, so we get typescript errors when using the LocalDocumentDataInput explicitly (even though indirectly through LocalConceptDataInput, LocalContentDataInput.)
It is not used yet, so just removing from input type for now.
I guess this did not arise earlier because we were building objects, not using the type explicitly.
ae3123f to
f71e309
Compare
c2ee00a to
1127f9a
Compare
f71e309 to
a96cd20
Compare
…ceptdatainput' into 1865b
a96cd20 to
af01ede
Compare
af01ede to
abacebf
Compare
| const isImportedFrom = (nodeLocalId: string): number => { | ||
| let cached = sourceIdOfNodes[nodeLocalId]; | ||
| if (cached === undefined) { | ||
| cached = sourceIdOfNodes[nodeLocalId] = | ||
| getSpaceIdOf(nodeLocalId) || spaceId; | ||
| } | ||
| return cached === spaceId ? 0 : cached; | ||
| }; |
There was a problem hiding this comment.
Critical Logic Bug: The isImportedFrom function always returns 0 because getSpaceIdOf (line 67) always returns undefined.
// Line 259: getSpaceIdOf always returns undefined
cached = sourceIdOfNodes[nodeLocalId] = undefined || spaceId;
// So cached always equals spaceId
// Line 261: Since cached === spaceId is always true
return cached === spaceId ? 0 : cached; // Always returns 0This breaks the logic at lines 279-281 where (isImportedFrom(r.sourceUid) || 0) in groupSpaces evaluates to 0 in groupSpaces, checking if property "0" exists instead of the actual space ID. This will cause relations with imported nodes to be incorrectly filtered.
Similarly at lines 102-104, spaceUids[isImportedFrom(r.sourceUid) || 0] always looks up spaceUids[0] which likely doesn't exist, causing all imported nodes to fall back to local UIDs when they should use RIDs.
Impact: Relations involving imported nodes will not be published correctly to groups. The code will either skip valid relations or fail to construct proper RIDs for cross-space references.
Fix: Either implement getSpaceIdOf properly or remove the imported node logic until ENG-1856 is complete (as mentioned in the PR description).
Spotted by Graphite
Is this helpful? React 👍 or 👎 to let us know.
There was a problem hiding this comment.
This is valid, but it's related to function that is expected to be integrated in ENG-1865 (forthcoming.) So the bug is really a placeholder.
abacebf to
0bb9a97
Compare
0bb9a97 to
3d229a1
Compare
https://linear.app/discourse-graphs/issue/ENG-1865/publish-roam-stored-relations-for-shared-nodes
Waiting for eng-1856 to work with relations to imported nodes; but functional otherwise.
One thing I expect to discuss: I put everything in one file, and it would be worth distributing code in various utility functions, and maybe breaking up the PR. We should discuss how to break it up, but I wanted to start from end-to-end functionality.
https://www.loom.com/share/74b4c5b9e750404e8ea1f59ace042492