Fix crash with container elements in spinner context#13659
Fix crash with container elements in spinner context#13659sfc-gh-kmcgrady merged 4 commits intodevelopfrom
Conversation
…ners in spinner The SetNodeByDeltaPathVisitor was incorrectly consuming an index from the delta path when visiting a TransientNode, causing a mismatch between expected and actual tree structure. This led to "Bad delta path index" errors when creating container elements (st.columns, st.tabs) inside a st.spinner context. The fix treats TransientNode as transparent in the delta path hierarchy (matching the behavior of GetNodeByDeltaPathVisitor) and preserves the transient wrapper when modifying nodes inside its anchor. Closes #13658 Co-Authored-By: Claude <[email protected]>
✅ PR preview is ready!
|
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
There was a problem hiding this comment.
Pull request overview
This PR fixes a regression causing app crashes when creating container elements (like st.columns or st.tabs) inside a container within a st.spinner context. The crash manifested as "Bad delta path index" errors.
Changes:
- Fixed
SetNodeByDeltaPathVisitor.visitTransientNodeto treat TransientNode as transparent in the delta path hierarchy (not consuming an index), matching the behavior ofGetNodeByDeltaPathVisitor - Updated and expanded tests to verify the fix and prevent regression
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
frontend/lib/src/render-tree/visitors/SetNodeByDeltaPathVisitor.ts |
Fixed visitTransientNode to not consume delta path index and preserve transient wrapper when drilling through anchor |
frontend/lib/src/render-tree/visitors/SetNodeByDeltaPathVisitor.test.ts |
Updated existing tests to reflect new behavior and added comprehensive test for the bug scenario |
SummaryThis PR fixes a regression (#13658) where creating container elements ( Key Changes:
Code QualityThe implementation is clean and well-documented: Strengths:
Analysis of the fix: The old code incorrectly consumed the first path index: const [, ...remainingPath] = this.deltaPath // Bug: consumed an indexThe new code passes through transparently: const newAnchor = node.anchor.accept(this) // Correct: same path, no index consumedThis aligns with Test CoverageThe test coverage is thorough and appropriate: Updated Tests:
New Test: The tests follow TypeScript best practices:
E2E Test Gap: There is no E2E test for this specific scenario, but given this is a frontend-only fix with comprehensive unit tests, the coverage appears adequate. The original issue is reproducible via manual testing per the issue description. Backwards CompatibilityNo breaking changes. This is a pure bug fix that:
The change corrects behavior that was causing crashes, making it a strict improvement. Security & RiskSecurity: No security concerns identified. The changes are localized to tree traversal logic with no impact on data handling, authentication, or external communication. Risk Assessment: Low risk.
RecommendationsNo critical issues found. Minor suggestions:
VerdictAPPROVED: This is a well-implemented bug fix that correctly addresses the regression by making This is an automated AI review using |
Co-Authored-By: Claude <[email protected]>
Regression test for issue #13658: verifies that creating container elements (st.columns) inside a st.spinner context doesn't crash the app. Co-Authored-By: Claude <[email protected]>
📈 Frontend coverage change detectedThe frontend unit test (vitest) coverage has increased by 0.0500%
🎉 Great job on improving test coverage! |
## Describe your changes Fix a regression where creating container elements (`st.columns`, `st.tabs`) inside a container within a `st.spinner` context caused the app to crash with "Bad delta path index" errors. The root cause was that `SetNodeByDeltaPathVisitor.visitTransientNode` incorrectly consumed an index from the delta path when visiting TransientNodes, while `GetNodeByDeltaPathVisitor` correctly treats them as transparent. This caused delta paths to become misaligned with the actual tree structure. The fix treats TransientNode as transparent in the delta path hierarchy and preserves the transient wrapper when modifying nodes inside its anchor. ## GitHub Issue Link (if applicable) Closes #13658 ## Testing Plan - Unit Tests (JS): Updated and added tests for `SetNodeByDeltaPathVisitor.visitTransientNode` to verify the fix - E2E Tests: Added regression test `test_spinner_with_container_elements` that reproduces the exact scenario from the issue - All 5630 frontend tests pass - All 201 render-tree tests pass --- **Contribution License Agreement** By submitting this pull request you agree that all contributions to this project are made under the Apache 2.0 license. --------- Co-authored-by: Ken McGrady <[email protected]> Co-authored-by: Claude <[email protected]>
Describe your changes
Fix a regression where creating container elements (
st.columns,st.tabs) inside a container within ast.spinnercontext caused the app to crash with "Bad delta path index" errors.The root cause was that
SetNodeByDeltaPathVisitor.visitTransientNodeincorrectly consumed an index from the delta path when visiting TransientNodes, whileGetNodeByDeltaPathVisitorcorrectly treats them as transparent. This caused delta paths to become misaligned with the actual tree structure.The fix treats TransientNode as transparent in the delta path hierarchy and preserves the transient wrapper when modifying nodes inside its anchor.
GitHub Issue Link (if applicable)
Closes #13658
Testing Plan
SetNodeByDeltaPathVisitor.visitTransientNodeto verify the fixtest_spinner_with_container_elementsthat reproduces the exact scenario from the issueContribution License Agreement
By submitting this pull request you agree that all contributions to this project are made under the Apache 2.0 license.