fix(net): join array fieldlist in net.retrieve so the documented usage works#475
Closed
james-enperso wants to merge 1 commit into
Closed
fix(net): join array fieldlist in net.retrieve so the documented usage works#475james-enperso wants to merge 1 commit into
james-enperso wants to merge 1 commit into
Conversation
…e works
net.retrieve's typed/documented signature takes `fieldlist: string[]`, but the
array was passed straight through to the bridge as the `fields` query param. On
Android it is URL-encoded as its Array toString ("[Name, Industry]") and rejected
by Salesforce (INVALID_FIELD / 400); iOS cannot produce a valid comma-joined value
from an NSArray either. So the documented/typed call form deterministically fails,
and the only form that works (a pre-joined string) contradicts the TypeScript type.
The shared net test dodges this by passing a pre-joined string.
Join the array before it crosses the bridge; a string is passed through unchanged
for the legacy pre-joined caller.
Note on dist/: `npm run build` (tsc --build) extends @react-native/typescript-config,
which sets noEmit:true, so it type-checks only and does NOT regenerate dist/. The
committed dist/ is CommonJS produced by a separate release-time config; a naive tsc
would re-emit it as ESM and break the package. dist/react.force.net.js is therefore
hand-synced here to mirror the compiled src change (the .d.ts is unchanged — the
signature is the same). The noEmit build discrepancy is worth a maintainer's look
separately.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015CGbVaRKrx7DeurX81NWdQ
4 tasks
Contributor
|
Hi @james-enperso — thank you for this! The bug diagnosis is spot-on, and flagging the We're closing this in favour of #477, which fixes the same
Your contribution is credited in the commit message. Thanks again for the thorough write-up! |
wmathurin
added a commit
that referenced
this pull request
Jul 7, 2026
…e works The documented/typed signature passes fieldlist as string[], but the raw array was forwarded straight to the native bridge as the `fields` query param. On Android, ArrayList.toString() produces "[FirstName, LastName]"; on iOS, NSArray's description gives a similar bracketed form — both are rejected by Salesforce with INVALID_FIELD / 400. The only working form (a pre-joined string) contradicted the TypeScript signature. Fix: join the array to a comma-separated string before the bridge crossing. A string is passed through unchanged for backward compatibility with callers that pre-join before passing. Also adds tsconfig.build.json so dist/ can be regenerated reproducibly via `tsc --project tsconfig.build.json` (the base tsconfig sets noEmit:true for type-checking only). setversion.sh updated to use this config, closing the gap where dist/ was previously hand-synced or relied on a separate unreproducible release-time step. The dist/ regeneration in this commit also picks up TypeScript version drift (null-coalescing rewrite, class field declarations) — functionally identical changes. Credit to @james-enperso for identifying the bug and the noEmit build discrepancy in PR #475.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
net.retrieve's public, typed, and documented signature takesfieldlist: string[]:…but the array was passed straight through to the native bridge as the
fieldsquery param:On Android the array is URL-encoded as its Java
ArrayList.toString()→fields=%5BFirstName%2C+LastName%5D(i.e.fields=[FirstName, LastName]), which Salesforce rejects withINVALID_FIELD/ 400; iOS can't produce a valid comma-joined value from anNSArrayeither. So the documented/typed usage deterministically fails, and the only form that works — a pre-joined string — contradicts the TypeScript signature. The sharednet.test.jsonly ever passes a pre-joined string, so the typed path was never exercised.Fix
Join the array before it crosses the bridge; a string is passed through unchanged for the legacy pre-joined caller:
Note on
dist/and the buildmainpoints atdist/index.js, so the fix must ship indist/too. However,npm run build(tsc --build) extends@react-native/typescript-config, which setsnoEmit: true— so it type-checks only and does not regeneratedist/. The committeddist/is CommonJS produced by a separate release-time config; a naivetscwould re-emit the tree as ESM and break the package. Sodist/react.force.net.jsis hand-synced here to mirror the compiledsrcchange (the.d.tsis unchanged — the signature is the same). Flagging thenoEmitbuild discrepancy for a maintainer to look at separately; a maintainer may prefer to regeneratedist/with the real release tooling.Test plan
net.retrievewith astring[]fieldlist (currently only the pre-joined-string form is tested).['FirstName','LastName']returns the fields on both platforms.🤖 Generated with Claude Code
https://claude.ai/code/session_015CGbVaRKrx7DeurX81NWdQ