react-resizable-panels 1.0.0 → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,6 +1,10 @@
1
1
  # Changelog
2
2
 
3
- ## 1.0.0
3
+ ## 1.0.1
4
+
5
+ - Small bug fix to guard against saving an incorrect panel layout to local storage
6
+
7
+ # 1.0.0
4
8
 
5
9
  - Remove support for pixel-based Panel constraints; (props like `defaultSizePercentage` should now be `defaultSize`)
6
10
  - Replaced `dataAttributes` prop with `...rest` prop that supports all HTML attributes
@@ -1189,7 +1189,10 @@ function PanelGroupWithForwardedRef({
1189
1189
  debouncedSave = debounce(savePanelGroupLayout, LOCAL_STORAGE_DEBOUNCE_INTERVAL);
1190
1190
  debounceMap[autoSaveId] = debouncedSave;
1191
1191
  }
1192
- debouncedSave(autoSaveId, panelDataArray, layout, storage);
1192
+
1193
+ // Clone panel data array before saving since this array is mutated.
1194
+ // If we don't clone, we run the risk of saving the wrong panel and layout pair.
1195
+ debouncedSave(autoSaveId, [...panelDataArray], layout, storage);
1193
1196
  }
1194
1197
  }, [autoSaveId, layout, storage]);
1195
1198
 
@@ -1252,7 +1252,10 @@ function PanelGroupWithForwardedRef({
1252
1252
  debouncedSave = debounce(savePanelGroupLayout, LOCAL_STORAGE_DEBOUNCE_INTERVAL);
1253
1253
  debounceMap[autoSaveId] = debouncedSave;
1254
1254
  }
1255
- debouncedSave(autoSaveId, panelDataArray, layout, storage);
1255
+
1256
+ // Clone panel data array before saving since this array is mutated.
1257
+ // If we don't clone, we run the risk of saving the wrong panel and layout pair.
1258
+ debouncedSave(autoSaveId, [...panelDataArray], layout, storage);
1256
1259
  }
1257
1260
  }, [autoSaveId, layout, storage]);
1258
1261
 
@@ -1228,7 +1228,10 @@ function PanelGroupWithForwardedRef({
1228
1228
  debouncedSave = debounce(savePanelGroupLayout, LOCAL_STORAGE_DEBOUNCE_INTERVAL);
1229
1229
  debounceMap[autoSaveId] = debouncedSave;
1230
1230
  }
1231
- debouncedSave(autoSaveId, panelDataArray, layout, storage);
1231
+
1232
+ // Clone panel data array before saving since this array is mutated.
1233
+ // If we don't clone, we run the risk of saving the wrong panel and layout pair.
1234
+ debouncedSave(autoSaveId, [...panelDataArray], layout, storage);
1232
1235
  }
1233
1236
  }, [autoSaveId, layout, storage]);
1234
1237
 
@@ -1165,7 +1165,10 @@ function PanelGroupWithForwardedRef({
1165
1165
  debouncedSave = debounce(savePanelGroupLayout, LOCAL_STORAGE_DEBOUNCE_INTERVAL);
1166
1166
  debounceMap[autoSaveId] = debouncedSave;
1167
1167
  }
1168
- debouncedSave(autoSaveId, panelDataArray, layout, storage);
1168
+
1169
+ // Clone panel data array before saving since this array is mutated.
1170
+ // If we don't clone, we run the risk of saving the wrong panel and layout pair.
1171
+ debouncedSave(autoSaveId, [...panelDataArray], layout, storage);
1169
1172
  }
1170
1173
  }, [autoSaveId, layout, storage]);
1171
1174
 
@@ -1191,7 +1191,10 @@ function PanelGroupWithForwardedRef({
1191
1191
  debouncedSave = debounce(savePanelGroupLayout, LOCAL_STORAGE_DEBOUNCE_INTERVAL);
1192
1192
  debounceMap[autoSaveId] = debouncedSave;
1193
1193
  }
1194
- debouncedSave(autoSaveId, panelDataArray, layout, storage);
1194
+
1195
+ // Clone panel data array before saving since this array is mutated.
1196
+ // If we don't clone, we run the risk of saving the wrong panel and layout pair.
1197
+ debouncedSave(autoSaveId, [...panelDataArray], layout, storage);
1195
1198
  }
1196
1199
  }, [autoSaveId, layout, storage]);
1197
1200
 
@@ -1259,7 +1259,10 @@ function PanelGroupWithForwardedRef({
1259
1259
  debouncedSave = debounce(savePanelGroupLayout, LOCAL_STORAGE_DEBOUNCE_INTERVAL);
1260
1260
  debounceMap[autoSaveId] = debouncedSave;
1261
1261
  }
1262
- debouncedSave(autoSaveId, panelDataArray, layout, storage);
1262
+
1263
+ // Clone panel data array before saving since this array is mutated.
1264
+ // If we don't clone, we run the risk of saving the wrong panel and layout pair.
1265
+ debouncedSave(autoSaveId, [...panelDataArray], layout, storage);
1263
1266
  }
1264
1267
  }, [autoSaveId, layout, storage]);
1265
1268
 
@@ -1235,7 +1235,10 @@ function PanelGroupWithForwardedRef({
1235
1235
  debouncedSave = debounce(savePanelGroupLayout, LOCAL_STORAGE_DEBOUNCE_INTERVAL);
1236
1236
  debounceMap[autoSaveId] = debouncedSave;
1237
1237
  }
1238
- debouncedSave(autoSaveId, panelDataArray, layout, storage);
1238
+
1239
+ // Clone panel data array before saving since this array is mutated.
1240
+ // If we don't clone, we run the risk of saving the wrong panel and layout pair.
1241
+ debouncedSave(autoSaveId, [...panelDataArray], layout, storage);
1239
1242
  }
1240
1243
  }, [autoSaveId, layout, storage]);
1241
1244
 
@@ -1093,7 +1093,10 @@ function PanelGroupWithForwardedRef({
1093
1093
  debouncedSave = debounce(savePanelGroupLayout, LOCAL_STORAGE_DEBOUNCE_INTERVAL);
1094
1094
  debounceMap[autoSaveId] = debouncedSave;
1095
1095
  }
1096
- debouncedSave(autoSaveId, panelDataArray, layout, storage);
1096
+
1097
+ // Clone panel data array before saving since this array is mutated.
1098
+ // If we don't clone, we run the risk of saving the wrong panel and layout pair.
1099
+ debouncedSave(autoSaveId, [...panelDataArray], layout, storage);
1097
1100
  }
1098
1101
  }, [autoSaveId, layout, storage]);
1099
1102
 
@@ -1069,7 +1069,10 @@ function PanelGroupWithForwardedRef({
1069
1069
  debouncedSave = debounce(savePanelGroupLayout, LOCAL_STORAGE_DEBOUNCE_INTERVAL);
1070
1070
  debounceMap[autoSaveId] = debouncedSave;
1071
1071
  }
1072
- debouncedSave(autoSaveId, panelDataArray, layout, storage);
1072
+
1073
+ // Clone panel data array before saving since this array is mutated.
1074
+ // If we don't clone, we run the risk of saving the wrong panel and layout pair.
1075
+ debouncedSave(autoSaveId, [...panelDataArray], layout, storage);
1073
1076
  }
1074
1077
  }, [autoSaveId, layout, storage]);
1075
1078
 
@@ -1167,7 +1167,10 @@ function PanelGroupWithForwardedRef({
1167
1167
  debouncedSave = debounce(savePanelGroupLayout, LOCAL_STORAGE_DEBOUNCE_INTERVAL);
1168
1168
  debounceMap[autoSaveId] = debouncedSave;
1169
1169
  }
1170
- debouncedSave(autoSaveId, panelDataArray, layout, storage);
1170
+
1171
+ // Clone panel data array before saving since this array is mutated.
1172
+ // If we don't clone, we run the risk of saving the wrong panel and layout pair.
1173
+ debouncedSave(autoSaveId, [...panelDataArray], layout, storage);
1171
1174
  }
1172
1175
  }, [autoSaveId, layout, storage]);
1173
1176
 
@@ -1035,7 +1035,10 @@ function PanelGroupWithForwardedRef({
1035
1035
  debouncedSave = debounce(savePanelGroupLayout, LOCAL_STORAGE_DEBOUNCE_INTERVAL);
1036
1036
  debounceMap[autoSaveId] = debouncedSave;
1037
1037
  }
1038
- debouncedSave(autoSaveId, panelDataArray, layout, storage);
1038
+
1039
+ // Clone panel data array before saving since this array is mutated.
1040
+ // If we don't clone, we run the risk of saving the wrong panel and layout pair.
1041
+ debouncedSave(autoSaveId, [...panelDataArray], layout, storage);
1039
1042
  }
1040
1043
  }, [autoSaveId, layout, storage]);
1041
1044
 
@@ -1011,7 +1011,10 @@ function PanelGroupWithForwardedRef({
1011
1011
  debouncedSave = debounce(savePanelGroupLayout, LOCAL_STORAGE_DEBOUNCE_INTERVAL);
1012
1012
  debounceMap[autoSaveId] = debouncedSave;
1013
1013
  }
1014
- debouncedSave(autoSaveId, panelDataArray, layout, storage);
1014
+
1015
+ // Clone panel data array before saving since this array is mutated.
1016
+ // If we don't clone, we run the risk of saving the wrong panel and layout pair.
1017
+ debouncedSave(autoSaveId, [...panelDataArray], layout, storage);
1015
1018
  }
1016
1019
  }, [autoSaveId, layout, storage]);
1017
1020
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-resizable-panels",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "description": "React components for resizable panel groups/layouts",
5
5
  "author": "Brian Vaughn <brian.david.vaughn@gmail.com>",
6
6
  "license": "MIT",
package/src/PanelGroup.ts CHANGED
@@ -225,7 +225,9 @@ function PanelGroupWithForwardedRef({
225
225
  debounceMap[autoSaveId] = debouncedSave;
226
226
  }
227
227
 
228
- debouncedSave(autoSaveId, panelDataArray, layout, storage);
228
+ // Clone panel data array before saving since this array is mutated.
229
+ // If we don't clone, we run the risk of saving the wrong panel and layout pair.
230
+ debouncedSave(autoSaveId, [...panelDataArray], layout, storage);
229
231
  }
230
232
  }, [autoSaveId, layout, storage]);
231
233