Today I used patch-package to patch react-resizable-panels@1.0.7 for the project I'm working on.
I was getting a constraint warning when the panel was rendered as collapsed on page load. Then it makes sense that the defaultSize is smaller than the minSize. So no need to emit the warning when the defaultSize is the collapsedSize.
Here is the diff that solved my problem:
diff --git a/node_modules/react-resizable-panels/src/utils/validatePanelConstraints.ts b/node_modules/react-resizable-panels/src/utils/validatePanelConstraints.ts
index 58f258c..d78b08a 100644
--- a/node_modules/react-resizable-panels/src/utils/validatePanelConstraints.ts
+++ b/node_modules/react-resizable-panels/src/utils/validatePanelConstraints.ts
@@ -33,7 +33,7 @@ export function validatePanelConstraints({
if (defaultSize != null) {
if (defaultSize < 0) {
warnings.push("default size should not be less than 0");
- } else if (defaultSize < minSize) {
+ } else if (defaultSize < minSize && defaultSize != collapsedSize) {
warnings.push("default size should not be less than min size");
}
Hi! 👋
Firstly, thanks for your work on this project! 🙂
Today I used patch-package to patch
react-resizable-panels@1.0.7
for the project I'm working on.I was getting a constraint warning when the panel was rendered as collapsed on page load. Then it makes sense that the defaultSize is smaller than the minSize. So no need to emit the warning when the defaultSize is the collapsedSize.
Here is the diff that solved my problem:
This issue body was partially generated by patch-package.