fix(sdk-client): omit undefined optional params from page.get() graphql.variables#36290
fix(sdk-client): omit undefined optional params from page.get() graphql.variables#36290rjvelazco wants to merge 4 commits into
undefined optional params from page.get() graphql.variables#36290Conversation
…ql.variables (#36108) page.get() spread the optional request params (personaId, publishDate, variantName) into requestVariables without defaults, leaving `undefined` values in the returned graphql.variables object. That object is returned verbatim on the response and breaks JSON serialization for Next.js Pages Router consumers (getServerSideProps/getStaticProps throw on undefined). Only include these optional params when they are defined. The GraphQL request itself is unaffected — the variables are nullable and JSON.stringify already drops undefined keys. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
Claude finished @rjvelazco's task in 56s —— View job Rollback Safety Analysis
Result: ✅ Safe To RollbackThe label "AI: Safe To Rollback" has been applied. Diff scope: 4 files changed, all within Category-by-category analysis:
Summary: This PR only modifies a TypeScript SDK utility function ( |
🤖 Bedrock Review —
|
undefined optional params from page.get() graphql.variables
#36108) Replace the per-param undefined guards with a generic removeUndefinedValues helper applied to the whole requestVariables object. This protects any variable from leaking `undefined` (e.g. mode/languageId/fireRules if a caller passes them explicitly as undefined), not just the optional ones. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…#36108) CI nx format:check flagged utils.ts. Collapse the single-statement helper signature/body to match the workspace prettier config. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
Tick the box to add this pull request to the merge queue (same as
|
Proposed Changes
Fixes #36108
client.page.get()returnedundefinedvalues insidegraphql.variables, breaking Next.js Pages Router apps that return the page response fromgetServerSideProps/getStaticProps(JSON has no representation forundefined).Root cause
In
core-web/libs/sdk/client/src/lib/client/page/page-api.ts, the optional request paramspersonaId,publishDate, andvariantNamewere destructured without defaults and spread verbatim intorequestVariables. That object is returned on the response, so theundefinedvalues surfaced to consumers.Fix
Only include the optional params (
personaId,publishDate,variantName) inrequestVariableswhen they are actually defined. The GraphQL request is unaffected — these variables are nullable andJSON.stringifyalready dropsundefinedkeys — so the only observable change is that the returnedgraphql.variablesobject is now JSON-serializable.Tests
personaId/publishDate/variantName: undefined.graphql.variablescontains noundefinedvalues and round-trips throughJSON.parse(JSON.stringify(...)).All 280
sdk-clienttests pass; lint clean.🤖 Generated with Claude Code