Skip to content

Fix bundled library subpath serialization - #7016

Open
harsh21234i wants to merge 4 commits into
reflex-dev:mainfrom
harsh21234i:fix/6975-bundled-library-subpaths
Open

Fix bundled library subpath serialization#7016
harsh21234i wants to merge 4 commits into
reflex-dev:mainfrom
harsh21234i:fix/6975-bundled-library-subpaths

Conversation

@harsh21234i

@harsh21234i harsh21234i commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes issue #6975.

compile_app() was clearing explicit bundle_library() registrations during frontend compilation. Dynamic components
also failed to rewrite bundled library subpath imports, such as Lucide deep imports.

Changes

  • Preserve user-registered bundled libraries during compilation.
  • Rewrite bundled default, named, and namespace subpath imports through window.__reflex.
  • Add unit tests for bundled-library preservation and subpath serialization.
  • Add browser integration coverage using a dynamically rendered Lucide icon.
  • Add required bugfix news fragments.

Tests

  • uv run pytest tests/units/compiler/test_dynamic_components_codegen.py tests/units/compiler/test_compiler.py -q
  • uv run pytest tests/integration/test_dynamic_components.py -q
  • Ruff checks and formatting pass.
  • Pyright passes for the changed source modules.

Review in cubic

@harsh21234i
harsh21234i requested a review from a team as a code owner September 1, 2026 13:44
@greptile-apps

greptile-apps Bot commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

The PR preserves explicit bundled-library registrations across compilation and routes dynamic subpath imports through their corresponding window.__reflex module namespaces.

  • Separates explicit library registrations from compile-derived registrations.
  • Generates unique browser namespace aliases for normalized library-name collisions.
  • Adds unit and browser integration coverage for Lucide subpath imports.

Confidence Score: 5/5

The PR appears safe to merge.

No blocking failure remains.

Important Files Changed

Filename Overview
packages/reflex-base/src/reflex_base/components/dynamic.py Tracks explicit registrations separately and reconstructs bundled subpath imports from exact window namespace entries.
packages/reflex-base/src/reflex_base/registry.py Adds registration-context storage and copying for explicitly bundled libraries.
reflex/compiler/compiler.py Preserves explicit registrations during compile resets and generates collision-free window-library aliases.
packages/reflex-components-radix/src/reflex_components_radix/plugin.py Registers Radix Themes as a compile-derived dependency while retaining compatibility with older reflex-base versions.
tests/units/compiler/test_dynamic_components_codegen.py Covers exact-subpath default and named import reconstruction plus app-root bundling.
tests/units/compiler/test_compiler.py Covers explicit-registration preservation, stale derived-registration removal, and normalized alias collisions.
tests/integration/test_dynamic_components.py Exercises a dynamically rendered Lucide icon through the browser integration path.

Reviews (4): Last reviewed commit: "Document bundled library helper return v..." | Re-trigger Greptile

Comment thread packages/reflex-base/src/reflex_base/components/dynamic.py
Comment thread packages/reflex-base/src/reflex_base/components/dynamic.py
@codspeed-hq

codspeed-hq Bot commented Sep 1, 2026

Copy link
Copy Markdown

Merging this PR will not alter performance

✅ 32 untouched benchmarks
⏩ 8 skipped benchmarks1


Comparing harsh21234i:fix/6975-bundled-library-subpaths (f8b7f63) with main (9a26753)

Open in CodSpeed

Footnotes

  1. 8 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All reported issues were addressed across 7 files

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

Comment thread packages/reflex-base/src/reflex_base/components/dynamic.py Outdated
Comment thread packages/reflex-base/src/reflex_base/components/dynamic.py Outdated
Comment thread reflex/compiler/compiler.py Outdated
Comment thread news/7016.bugfix.md

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All reported issues were addressed across 8 files (changes from recent commits).

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

Comment thread reflex/compiler/compiler.py
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant