fix(loadable-components): skip transformation when ssr: false is specified#592
Conversation
…ified
When loadable() is called with { ssr: false } in the options object,
the plugin now skips the SSR transformation as required by the
loadable-components API.
Fixes #465
Co-authored-by: Donny/강동윤 <kdy1@users.noreply.github.com>
|
|
|
Code ReviewOverall this is a clean, correct fix for issue #465. The implementation is straightforward and well-targeted. A few observations: CorrectnessThe logic in
One edge case worth considering: computed property keys like Missing changesetThe changeset-bot flagged that there's no changeset file. Since this is a bug fix that changes observable behavior, a Test coverageThe added test covers the basic case well. Consider adding tests for:
Minor style noteThe intermediate SummaryThe implementation is correct and the approach is appropriate. The main actionable items are:
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: af29599f5f
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| obj.props.iter().any(|prop| match prop { | ||
| PropOrSpread::Prop(prop) => match prop.as_ref() { | ||
| Prop::KeyValue(kv) => { | ||
| let is_ssr_key = match &kv.key { | ||
| PropName::Ident(i) => &*i.sym == "ssr", |
There was a problem hiding this comment.
Respect later overrides when checking
ssr: false
has_ssr_false() now returns true if any property in the options object is ssr: false, but JavaScript object literals are order-sensitive. Inputs like loadable(() => import('./Comp'), { ssr: false, ...opts }) or { ssr: false, ssr: true } end up with ssr !== false at runtime, yet this branch still skips the transform entirely. In those cases we silently drop the loadable SSR metadata even though SSR is effectively enabled.
Useful? React with 👍 / 👎.
## Summary - Addressed `chatgpt-codex-connector[bot]` review follow-ups across merged PRs: #585, #591, #592, #593, #594, #595, #597, #598, #599. - Applied the fixes as 9 separate commits (one commit per original PR) in a single follow-up branch. ## What Changed - #585 / #592 (`loadable-components`) - Fixed source-less default-import matching to honor the configured local name. - Updated `ssr: false` detection to respect final object-literal override order. - Added/updated fixtures for both behaviors. - #591 / #594 (`formatjs`) - Added JSX member-expression message component support (e.g. `ReactIntl.FormattedMessage`). - Updated #532 regression coverage to validate the `ast: true` path. - #593 / #595 (`graphql-codegen-client-preset`) - Extended `namingConvention` parsing to accept string/object forms. - Preserved names for `keep`/unknown conventions instead of forcing PascalCase. - Fixed Windows absolute `filename` path handling in WASM runtime path resolution. - Added unit coverage for the new config/path behaviors. - #597 / #599 (`emotion`) - Ensured tagged-template labels are terminated before sourcemap comments. - Added css-prop rewrite support for namespace imports (`emotionReact.css`). - Attached PURE comments to the generated call site span. - Updated emotion fixtures accordingly. - #598 (docs) - Corrected capability descriptions in `packages/jest/README.tmpl.md` and `packages/swc-sdk/README.tmpl.md`. ## Validation - `cargo test -p swc_plugin_loadable_components --test fixture -- --ignored` - `cargo test -p swc_plugin_graphql_codegen_client_preset` - `cargo test -p swc_emotion --test fixture -- --ignored` - `pnpm -C /Users/kdy1/.codex/worktrees/17e6/plugins/packages/formatjs test` All passed (formatjs has an existing non-blocking Vitest warning about an un-awaited rejects assertion).
When loadable() is called with { ssr: false } in the options object, the plugin now skips the SSR transformation as required by the loadable-components API.
Fixes #465
Generated with Claude Code