Feat(frontend): save splitpanes and tabs
Add possibility to save splitpanes && tab layout
[!IMPORTANT] This pull request adds functionality to save and restore split pane layouts and tab states in the frontend, updating multiple components to support this feature.
- Behavior:
- Adds ability to save and restore split pane layouts and tab states in
FlowBuilder.svelte.- Introduces
savedSplitPanesLayoutandtabsStateFromUrlprops inFlowBuilder.svelte.- Updates
saveSessionDraft()to includesplit_panes_layoutandtabs_state.- Components:
- Adds
SplitPanesLayoutandTabsStateclasses for managing layouts and tab states.- Updates
Splitpanes.svelteandPane.svelteto handle pane activation and resizing.- Modifies
Tabs.svelteandTabsV2.svelteto useTabsStatefor managing selected tabs.- Files:
- Adds
splitPanesdirectory withPane.svelte,Splitpanes.svelte,SplitPanesLayout.svelte.ts, andtypes.ts.- Updates multiple components to use new
splitPanesandtabsStatelogic, includingFlowEditor.svelte,ModulePreviewResultViewer.svelte, and others.- Misc:
- Updates
+page.sveltefiles inflows/addandflows/editto handle new layout and tab state props.This description was created by
for 74795bec7198eec3b3ec7c6df1d78d892afff946. You can customize this summary. It will automatically update as commits are pushed.
Deploying windmill with
Cloudflare Pages
| Latest commit: |
74795be
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://d582d3a8.windmill.pages.dev |
| Branch Preview URL: | https://feat-frontend-save-flow-buil.windmill.pages.dev |
code looks great !
/ai review pr
Claude finished @diegoimbert's task —— View job
PR Review: Feat(frontend): save splitpanes and tabs
I'll review this PR that adds split pane layout and tab state persistence functionality.
Todo List:
- [x] Read and understand the main implementation files
- [x] Analyze the new SplitPanesLayout and TabsState classes
- [x] Review component updates and integration
- [x] Check against Svelte 5 best practices
- [x] Review existing feedback from ellipsis-dev
- [x] Provide comprehensive review feedback
✅ Overall Assessment: APPROVE with Minor Suggestions
This PR implements a robust state management system for preserving split pane layouts and tab selections across sessions. The implementation follows Svelte 5 patterns excellently and integrates cleanly with the existing FlowBuilder architecture.
Strengths:
✅ Excellent Svelte 5 Usage: Proper use of $state, $derived, $effect, and private class fields
✅ Clean Architecture: Well-separated concerns with context-based state sharing
✅ Performance Considerations: 500ms debounced persistence prevents excessive localStorage writes
✅ Type Safety: Good TypeScript usage with proper interfaces
✅ Integration: Seamless integration with existing components
✅ Memory Management: Proper cleanup in onDestroy lifecycle
Issues Found:
🔴 Critical Issue (Needs Fix):
Potential Null Pointer in setActivePane (SplitPanesLayout.svelte.ts:25):
setActivePane(layoutId: string, paneIndex: number) {
if (!this.#layout[layoutId][paneIndex].size) { // ❌ Can crash if layoutId doesn't exist
Recommended Fix:
setActivePane(layoutId: string, paneIndex: number) {
if (!this.#layout[layoutId]?.[paneIndex]?.size) {
return
} else {
this.#layout[layoutId][paneIndex].active = true
this.#scalePanes(layoutId, paneIndex)
}
this.#changeCb?.()
}
🟡 Minor Suggestions:
-
Add Error Boundary for State Restoration (
FlowBuilder.svelte:159-163): Consider wrapping state initialization in try-catch for malformed localStorage data. -
Add JSDoc Comments: The complex scaling algorithms in
SplitPanesLayoutwould benefit from documentation explaining the mathematical approach. -
Consistent Naming (Very Minor):
setTabStateContextvssetSplitPanesLayoutContext- minor inconsistency but not critical.
✅ Already Addressed Issues:
The ellipsis-dev reviews identified several issues that have been properly fixed:
- ✅ Missing
idprop in TabsV2 - ✅ Uninitialized
tabsStatevariable - ✅ Various type safety improvements
Code Quality Assessment:
- Svelte 5 Best Practices: ⭐⭐⭐⭐⭐ Excellent
- Type Safety: ⭐⭐⭐⭐⭐ Very Good
- Performance: ⭐⭐⭐⭐⭐ Excellent (debouncing, minimal reactivity)
- Architecture: ⭐⭐⭐⭐⭐ Clean separation of concerns
- Error Handling: ⭐⭐⭐⭐ Good (one critical fix needed)
Recommendation:
APPROVE after fixing the null pointer issue in setActivePane. This is a well-designed feature that significantly improves the developer experience by preserving UI state across sessions.
The implementation demonstrates strong understanding of Svelte 5 patterns and follows the repository's architectural conventions well.