fix(code-help): correct the identity and segment snippets - #8146
Conversation
These snippets render on the Identity, Identities and Segments pages.
- `cond && \`...\`` inside a template literal renders the string "false" into
the snippet whenever the API URL is not custom, i.e. on SaaS. Ten templates
did this, so the output read `apiKey = "KEY"false`.
- The Node snippets imported a default export @flagsmith/nodejs does not have.
It is `import { Flagsmith }`, as docs/.../server-side.mdx already shows;
without it the snippet throws SyntaxError on the first line.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (11)
📝 WalkthroughWalkthroughThe generated iOS, Java, PHP, Ruby, and Rust templates now emit optional custom Flagsmith URL configuration only when enabled, avoiding interpolated boolean values. Node templates switch from default to named Estimated code review effort: 2 (Simple) | ~10 minutes Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Docker builds report
|
✅ private-cloud · depot-ubuntu-latest-16 — run #18812 (attempt 1)Playwright Test Results (private-cloud - depot-ubuntu-latest-16)Details
🗂️ Previous results✅ private-cloud · depot-ubuntu-latest-arm-16 — run #18812 (attempt 1)Playwright Test Results (private-cloud - depot-ubuntu-latest-arm-16)Details
✅ oss · depot-ubuntu-latest-arm-16 — run #18812 (attempt 1)Playwright Test Results (oss - depot-ubuntu-latest-arm-16)Details
✅ oss · depot-ubuntu-latest-16 — run #18812 (attempt 1)Playwright Test Results (oss - depot-ubuntu-latest-16)Details
|
Visual Regression19 screenshots compared. See report for details. |
docs/if required so people know about the feature.Changes
Split out of #8145, which fixes the same class of bug in the snippets the onboarding renders. These eleven render on the Identity, Identities and Segments pages instead.
Two bugs:
falsein the output. Ten templates used${cond && \…`}inside a template literal, which renders the stringfalsewhencondis false, i.e. on SaaS. The iOS snippet readFlagsmith.shared.apiKey = "KEY"false`. Now a ternary with an empty fallback.@flagsmith/nodejsdoesn't have, so the first line throwsSyntaxError: The requested module '@flagsmith/nodejs' does not provide an export named 'default'. It'simport { Flagsmith }, which is whatdocs/integrating-with-flagsmith/sdks/server-side.mdx:257already shows.How did you test this code?
The Node import is verified in #8145, where the same fix to
init-node.jswas executed against@flagsmith/nodejs@9: it throws before the change and reaches the network call after.The
falsefix is verified by rendering: every template was rendered with a non-custom API URL and checked for a boolean glued onto the preceding value. #8145 adds a unit test asserting exactly that for the init snippets.falsefalseimport { Flagsmith } from "@flagsmith/nodejs"