From 4db6d45b201844d6bd62424015ab7e15b07af24a Mon Sep 17 00:00:00 2001 From: foxriver76 Date: Tue, 9 Jan 2024 08:55:02 +0100 Subject: [PATCH] implemented workaround resize bug for https://github.com/devbookhq/splitter/issues/15 - closes #282 --- README.md | 1 + src/src/App.jsx | 12 ++++++++++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index c0fc5614..e151040e 100644 --- a/README.md +++ b/README.md @@ -234,6 +234,7 @@ E.g., if it was used in a menu and the menu is red, the circle would be red. * (foxriver76) fixed last change y-offset for some widgets * (foxriver76) fixed issue where JquiState did not respect data type * (foxriver76) fixed issues with BulkEdtior (dialog not closing and other dialog showing wrong button) +* (foxriver76) implemented workaround resize bug for https://github.com/devbookhq/splitter/issues/15 ### 2.9.13 (2024-01-08) * (foxriver76) correctly detect IDs in bindings when they contain hash character diff --git a/src/src/App.jsx b/src/src/App.jsx index 59b5cd4b..58980d18 100644 --- a/src/src/App.jsx +++ b/src/src/App.jsx @@ -1965,8 +1965,16 @@ class App extends Runtime { } else { splitSizes = newSizes; } - this.setState({ splitSizes }); - window.localStorage.setItem('Vis.splitSizes', JSON.stringify(splitSizes)); + + const sum = splitSizes.reduce((prev, curr) => prev + curr); + if (Math.ceil(sum) !== 100) { + // https://github.com/devbookhq/splitter/issues/15 + console.log('Decline resize, to work around bug in @devbookhq/splitter'); + this.setState({ splitSizes: this.state.splitSizes }); + } else { + this.setState({ splitSizes }); + window.localStorage.setItem('Vis.splitSizes', JSON.stringify(splitSizes)); + } }} theme={this.state.themeName === 'dark' ? GutterTheme.Dark : GutterTheme.Light} gutterClassName={this.state.themeName === 'dark' ? 'Dark visGutter' : 'Light visGutter'}