A dev run stopped before its backend loads leaves .web/nocompile, so the next run or export skips the compile
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 2/5
- 预计耗时
- 1-3 小时
- 新手友好度
- 75/100
- Issue 类型
- 缺陷
- 描述清晰度
- 描述清楚
- 活跃度
- 活跃
- 技术栈
- python
- 领域
- build-system, testing
调研方向
从 reflex/utils/prerequisites.py 中的 get_compiled_app 开始,然后阅读 App._should_compile 如何处理 .web/nocompile,以及后端 worker 如何使用它。在 tests/units/utils/test_prerequisites.py 中添加一个回归测试,创建该标记并确认 get_compiled_app 会执行编译;完成标准是该测试在修复前失败、修复后通过。
由索引模型根据 Issue 内容生成。
描述
Summary
A dev reflex run creates .web/nocompile so that its backend worker does not compile the app a second time. Only that worker deletes the marker, when it first loads the app. If the run stops before the worker loads the app, the marker stays. The next CLI compile then consumes the marker and skips the compile:
reflex runserves the old frontend until a file save triggers a hot reload.reflex exportskips the compile, builds the old pages, and exits 0. A deploy from that machine ships the old frontend without a warning.
This is the same family as #7089. The fix in #7125 covered backend-only runs only.
Steps to reproduce
Use any app. Use explicit ports.
- Run
reflex runonce to completion, then stop it. - Run
reflex runagain. Press Ctrl+C right afterApp running at:is printed. On a small app the window is about 0.8 s. It is longer on a larger app. - Check that
.web/nocompileexists. - Change visible text in a page, for example
rx.heading("V1")torx.heading("V2"). - Do one of these:
- Run
reflex run. NoCompiling:progress bar is shown. The browser showsV1. It staysV1until you save a file. - Run
reflex export --frontend-only --no-zip. The command exits 0, but.web/build/clientcontainsV1, notV2.
- Run
Expected
A CLI command that compiles (reflex run, reflex export, reflex compile) always compiles. A marker left by an earlier run does not skip the compile.
Cause
run_backendcreates the marker when a frontend is present.App._should_compiledeletes the marker and returnsFalse. The CLI compile and the backend worker compile both call it, so a stale marker skips whichever compile runs first.
Suggested fix
The CLI paths reach the compile only through prerequisites.get_compiled_app (see the comment in App._compile). The backend worker uses App.__call__. So get_compiled_app can delete a stale marker before it compiles:
app, app_module = get_and_validate_app(reload=reload)
+ # The marker only lets the backend that a dev run starts skip its compile.
+ # A run stopped before that backend loaded leaves it behind.
+ (get_web_dir() / constants.NOCOMPILE_FILE).unlink(missing_ok=True)
app._compile(
I tested this change with the steps above:
reflex runafter the early Ctrl+C compiles and serves the new text.reflex exportafter the early Ctrl+C builds the new text.- A normal dev run still compiles once. The backend worker still consumes the marker and skips its own compile.
The fix needs a regression test, for example in tests/units/utils/test_prerequisites.py: create the marker, call get_compiled_app, and assert that a real compile ran.
- 主要语言
- Python
- 星标
- 29k
- 派生
- 1.8k
- 平均合并
- 2 天 22 小时
- 30 天内合并 PR
- 143
环境准备
在浏览器里用你自己的 GitHub 账号启动这个项目的开发容器。
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
reflex-dev/reflex 的其他 Issue
-
Operations on a list[T] | None var throw when the value is None可能已有人在做 @masenf 今天认领。 未关闭
难度 2/5 1-3 小时 新手友好度 72/100
reflex-dev/reflex#7826 · 1 条评论 ·
维护者通常 1 天内回复
-
PropsBase nested serialization applies parent include/exclude filters to child fields可能已有人在做 @harsh21234i 于 1 天前认领。 未关闭
难度 2/5 1-3 小时 新手友好度 78/100
reflex-dev/reflex#7787 · 1 条评论 ·
维护者通常 1 天内回复
-
OTel: add trace_flags to JSON log records so unsampled trace ids are recognizable可能已有人在做 @ShaanGS 于 7 天前认领。 未关闭enhancement
难度 2/5 1-3 小时 新手友好度 82/100
reflex-dev/reflex#7729 · 1 条评论 ·
维护者通常 1 天内回复
-
0.9.12 changelog follow-ups: the #7132 "_get_was_touched" entry describes unreachable behaviour, #7115's hasattr/getattr change is undocumented, #7131's wording可能重新可做 关联的 PR 已关闭且未合并。 未关闭
难度 2/5 1-3 小时 新手友好度 70/100
reflex-dev/reflex#7260 · 2 条评论 ·
维护者通常 1 天内回复
-
ClientStateVar: a component that mounts while the value is non-default never re-renders on the push back to the default可能重新可做 关联的 PR 已关闭且未合并。 未关闭
难度 2/5 1-3 小时 新手友好度 78/100
reflex-dev/reflex#6823 · 1 条评论 ·
维护者通常 1 天内回复
查看 reflex-dev/reflex 的全部 Issue
相似的 Issue
-
[Bug]: graphify query loads every language extractor just for _file_stem (about 34 ms per call)可能已有人在做 @rohit-jsfreaky 今天认领。 未关闭
难度 2/5 1-3 小时 新手友好度 78/100
Graphify-Labs/graphify#5160 · 1 条评论 ·
维护者通常 2 天内回复
-
Variable declared without a value suppresses ${VAR:-default} expansion可能已有人在做 @Omarinho12345 今天认领。 未关闭
难度 2/5 1-3 小时 新手友好度 85/100
theskumar/python-dotenv#750 ·
维护者通常 12 天内回复
-
bug
难度 2/5 1-3 小时 新手友好度 68/100
-
难度 2/5 1-3 小时 新手友好度 78/100
UKGovernmentBEIS/control-arena#947 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 70/100
jasonacox/Powerwall-Dashboard#897 · 1 条评论 ·
维护者通常 1 天内回复