[codex] Fix memoized component hook prop rendering#6506
Conversation
Merging this PR will degrade performance by 3.8%
|
| Benchmark | BASE |
HEAD |
Efficiency | |
|---|---|---|---|---|
| ❌ | test_get_all_imports[_complicated_page] |
2.8 ms | 2.9 ms | -4.37% |
| ❌ | test_get_all_imports[_stateful_page] |
548.2 µs | 566.5 µs | -3.22% |
Tip
Investigate this regression by commenting @codspeedbot fix this regression on this PR, or directly use the CodSpeed MCP with your agent.
Comparing codex/fix-data-editor-memo-hook-props (a217b65) with main (c3c720f)2
Footnotes
-
2 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. ↩
-
No successful run was found on
main(39c74cb) during the generation of this report, so c3c720f was used instead as the comparison base. There might be some changes unrelated to this pull request in this report. ↩
Greptile SummaryFixes a bug where auto-memo component modules were compiled with missing hook-mutated props because
Confidence Score: 5/5Safe to merge — the change is a two-line order swap with a direct regression test that proves the fix. The root cause is well-understood (render captured props before add_hooks had a chance to mutate them), the fix is minimal and surgical, the if-branch (root-only memos) was already ordering hooks before render and is unaffected, and the new HookGeneratedProp stub plus its test directly exercise the fixed path end-to-end. No files require special attention. Important Files Changed
Sequence DiagramsequenceDiagram
participant CU as compile_experimental_component_memo
participant R as render (deep copy)
participant AH as _get_all_hooks() / add_hooks()
participant RE as render()
Note over CU: else branch (non-root-only memo)
CU->>R: copy.deepcopy(definition.component)
Note over CU,R: BEFORE fix: render() called first
rect rgb(255,200,200)
CU-->>RE: "rendered = render.render() ❌"
CU-->>AH: "hooks = _get_all_hooks() ← too late"
end
Note over CU,R: AFTER fix: _get_all_hooks() first
rect rgb(200,255,200)
CU->>AH: "hooks = _get_all_hooks() ✅"
CU->>RE: "rendered = render.render() ← sees mutated props"
end
CU->>R: _get_all_custom_code()
CU->>R: _get_all_dynamic_imports()
CU->>R: _get_all_imports()
Reviews (1): Last reviewed commit: "Fix memoized component hook prop renderi..." | Re-trigger Greptile |
84fbe7e to
a217b65
Compare
Summary
Root Cause
The auto-memo full-component path rendered before calling get_all_hooks(). DataEditor.add_hooks() generates the getData* hook and mutates the component with the getCellContent prop, so the memoized docs module included the hook function but rendered without getCellContent. Glide then tried to call the missing callback and the docs page failed with TypeError: x is not a function.
Validation