Repository navigation
Add shim for removed reflex component CLI command - #7497
Conversation
The custom components CLI was removed in 0.10, so every `reflex component` subcommand failed with "No such command 'component'. Did you mean 'compile'?" and no hint about where the workflow moved. Register a hidden `component` shim that accepts any subcommand and flags, logs that the command was removed in Reflex 0.10, points at the wrapping React docs and https://github.com/reflex-dev/component-template, and exits 1. `reflex component --help` prints the same pointer. The command stays out of `reflex --help`, and the plural typo `reflex components` now suggests it. Fixes #7490 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01CEngePWmkuAQ31xWPb1Q9L
|
Merging this PR will improve performance by 5.6%
|
| Benchmark | BASE |
HEAD |
Efficiency | |
|---|---|---|---|---|
| ⚡ | test_hydration_metadata[200] |
2 ms | 1.8 ms | +5.6% |
Tip
Curious why performance improved? Comment @codspeedbot explain why performance improved on this PR, or directly use the CodSpeed MCP with your agent.
Comparing claude/beautiful-edison-jtk7eu (aefcd44) with main (8239259)
Footnotes
-
18 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. ↩
|
CI: The step "Run unit tests w/ redis and OPLOCK_ENABLED" of the unit-tests run on aefcd44 (run 37652759387, job 112900156229) failed on exactly one test, Why it is not this PR's:
Root cause, a pre-existing race in the test's precondition: Proposed fix, verified locally (passes 3/3 with the delayed subscriber, with a normal subscriber in both modes, and with the mocked Redis), left out of this PR to keep it scoped to the CLI shim: # tests/units/test_state.py, test_state_manager_lock_expire_contend, just before `tasks = [`
if environment.REFLEX_OPLOCK_ENABLED.get():
# The blocker leases the lock only once the lock-update subscriber is
# ready; otherwise it falls back to one fenced write, which expires.
await state_manager_redis._ensure_lock_task_subscribed()I cannot re-run the failed job from here: the re-run request is rejected with 403 "Resource not accessible by integration", so a maintainer would need to re-run it, or say the word and I will carry the one-line test fix in this PR. Update: the maintainer re-run (attempt 2) passed every step, including the oplock pass, and the unit-tests gate is green. The proposed test fix above still stands as a follow-up for the underlying race. Generated by Claude Code |
FarhanAliRaza
left a comment
There was a problem hiding this comment.
Exercised the shim on this PR vs main: reflex component with no args, init, build --foo -x, share --bar=1, install and -h all print the pointer message and exit 1 (main: "No such command", exit 2). reflex component --help exits 0 with the same text, the command stays hidden from reflex --help, and init/cloud/--version are unaffected. The linked docs section and component template exist in the repo, tests/units/test_reflex.py passes (48), ruff is clean, and the news fragment is present.
Nit, non-blocking: -h isn't a help flag in reflex, so it hits the shim (exit 1) while --help exits 0.
Generated by Claude Code
|
Re the Generated by Claude Code |
Type of change
Description
Replaces the removed
reflex componentcommand with a hidden shim that gracefully guides users to the new workflow instead of showing a "No such command" error.Changes:
reflex/reflex.py: Added a hiddencomponentcommand that:reflex component init,build,share,install)ignore_unknown_options=Trueto prevent Click from raising "No such command" errorstests/units/test_reflex.py: Updated and expanded tests:test_component_command_is_not_registered()totest_component_command_is_hidden()— verifies the command exists but is hidden from--helpoutputtest_component_command_points_to_template()— ensures all old subcommands redirect with the helpful messagetest_component_help_points_to_template()— verifies--helpinvocations show the pointertest_component_command_dispatches_from_cli()— integration test confirming the shim works when invoked via subprocesscomponent --helpin the denied modules listnews/+component-cli-shim.bugfix.md: Added changelog fragment documenting the user-facing improvement.Test Plan
All new and modified tests pass:
https://claude.ai/code/session_01CEngePWmkuAQ31xWPb1Q9L