fix: keep app wraps below the sticky badge renderable

Merged
MA
24d ago
+38-1

All Submissions:

  • Have you followed the guidelines stated in CONTRIBUTING.md file?
  • Have you checked to ensure there aren't any other open Pull Requests for the desired changed?

Type of change

  • Bug fix (non-breaking change which fixes an issue)

Changes To Core Features:

  • Have you added an explanation of what your changes do and why you'd like us to include them?
  • Have you written new tests for your core changes, as applicable?
  • Have you successfully ran tests with your changes locally?

Summary

closes #6143

App._app_root sorts app wraps by priority descending and nests each lower-priority wrap as a child of the previous one. The "Built with Reflex" badge was registered as the bare @memo component, whose compiled function memo(({}) => jsx("a", …)) never reads props.children, so in production with the default show_built_with_reflex=True every wrap below it was emitted into root.jsx and dropped at render. rx.data_editor's (-1, "DataEditorPortal") wrap was the victim: <div id="portal"> never reached the DOM, Glide Data Grid logged "Cannot open Data Grid overlay editor, because portal not found", and no overlay cell editor — including the image-preview carousel from #7081 — could open in any deployed default-config app. Dev (no badge) worked, which is why #6143 looked OS-specific.

What changed

  • reflex/app.py: register the badge wrap as Fragment.create(memoized_badge()), the idiom the toaster and default-overlay wraps already use, so a lower-priority wrap becomes a sibling of the badge. One line plus a comment; no public API or component signature change, so no .pyi regeneration.
  • Rejected alternatives: giving StickyBadge *children (they would render inside the badge's <a href="https://reflex.dev">, so clicks in the overlay would navigate away) and re-prioritising the portal (moves the collision and needs a component-package release).

Tests

  • tests/units/test_app.py::test_sticky_badge_wrap_keeps_lower_priority_wrap_renderable: asserts on the compiled nesting (the portal div is in root.jsx either way; only the nesting differs). Fails on main, passes here.
  • pyright 0 errors; ruff / format clean; full units 9137 passed together with the other campaign fixes.

Verification against the real breakage

Prod A/B on the same tree with the pre-release campaign's 12-line data_editor app and a Playwright probe, default badge setting: unfixed → portal_exists=false, no overlay, 2× "portal not found"; fixed → portal_exists=true, badge still rendered (text, fixed position, z-index, bottom-right), the carousel opens with its four images and no console error. The reviewer rebuilt both variants independently and got byte-identical probe results.

Notes for review

  • The general shape survives: a childless app wrap registered above another wrap still silently drops it (no such combination ships today — the badge was the only leaf wrap, and reflex-enterprise's DnDProvider/MantineProvider wraps sit above it and render children). _app_root could warn, and the "leaf wraps wrap themselves in a Fragment" contract deserves a sentence in the app_wraps docstring.
  • Independent adversarial review: approved, no blocking issues. Report: fixes/f012/REPORT.md.

🤖 Generated with Claude Code

https://claude.ai/code/session_01NeyxWsuC9hqSKq8YcEwZyY


Generated by Claude Code