ENG-1909 Add no-op Next.js content upsert endpoint#1220
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
This pull request has been ignored for the connected project Preview Branches by Supabase. |
4cd8e3f to
7fc6f80
Compare
7fc6f80 to
d43d61e
Compare
| [dbVarName]: null, | ||
| [localVarName]: null, | ||
| [inlineVarName]: null, | ||
| ...decodeRef(ref, dbVarName, localVarName), |
There was a problem hiding this comment.
Runtime error when ref is undefined. The function decodeRefWithInlineNulls accepts an optional ref?: Ref parameter (line 68), but unconditionally calls decodeRef(ref, ...) on line 79. This will crash when ref is undefined, which occurs in the actual usage on lines 144-148 and 149-153 where no ref parameter is passed.
Fix by adding a conditional check:
return {
[dbVarName]: null,
[localVarName]: null,
[inlineVarName]: null,
...(ref ? decodeRef(ref, dbVarName, localVarName) : {}),
} as Record<DbVarName, number | null> &
Record<LocalVarName, string | null> &
Record<InlineVarName, null>;| ...decodeRef(ref, dbVarName, localVarName), | |
| ...(ref ? decodeRef(ref, dbVarName, localVarName) : {}), |
Spotted by Graphite
Is this helpful? React 👍 or 👎 to let us know.
https://linear.app/discourse-graphs/issue/ENG-1909/add-no-op-nextjs-content-upsert-endpoint
Content upsert, based on cross-app types.
This introduces a StandaloneContent type for upserting contents outside of concepts, following existing sync functions.
https://www.loom.com/share/cbffbfccbb384220bfe0a8aa80981b9d