PR: Reduce Render Bounce & Clean Up #59
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
🔧 PR: Reduce Render Bounce & Clean Up Debug Noise
Summary
This PR addresses a critical issue with layout render bounce and also improves maintainability by cleaning up excessive debug logging in the unified layout system. It consists of a multi-phase implementation that introduces a versioned layout controller, bounce detection, and patch clean-up for consistent UI rendering in Plugin Studio.
✅ Key Improvements
1. Debug Logging Cleanup
Removed
console.logand other dev-only debug statements from:DynamicPluginRenderer.tsxPluginModuleRenderer.tsxLegacyModuleAdapter.tsxLayoutEngine.tsxuseLayout.tslayoutChangeManager.tsLogging was previously overwhelming and made it harder to isolate real issues.
2. Bounce Detection Logic (Phase 1 & 2)
Introduced bounce suppression via:
previousPositionsRefandintendedPositionsRefinLayoutEngine.tsx3. Versioned Layout Controller (Phase A/B)
Added state machine (
idle,resizing,dragging,grace,commit) to control layout state flow.Introduced:
workingLayoutsRefandcanonicalLayoutsReflastVersionRefto track update versionsPrevented layout flicker and unnecessary renders when changes re-apply old state.
4. Debounced Commit System (Phase C)
5. Plugin Studio Adapter Compatibility
Updates to
PluginStudioAdapter.tsxand layout flush logic ensure:New ref:
unifiedLayoutStateRefenables flush + snapshot.6. Visual Debug Badge
LayoutCommitBadge.tsxdisplays version/hash and whether layout changes are pending.7. Dev Mode Testing Tools
Adds
test_phase1.shto walk through dev testing scenarios.Logging chain includes:
[LayoutEngine] Commit[UnifiedLayoutState] Persist[PluginStudioAdapter] Convert[useLayout] Apply[savePage] Serialize