@gravity-ui/dashkit 3.1.0-alpha.0 → 3.1.0-alpha.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.
|
@@ -264,16 +264,26 @@ function useMemoStateContext(props) {
|
|
|
264
264
|
});
|
|
265
265
|
}, [props.config, props.itemsStateAndParams, onChange]);
|
|
266
266
|
const memorizeOriginalLayout = react_1.default.useCallback((widgetId, preAutoHeightLayout, postAutoHeightLayout) => {
|
|
267
|
+
let needUpdateLayout = false;
|
|
267
268
|
if (!(widgetId in originalLayouts.current)) {
|
|
268
269
|
originalLayouts.current[widgetId] = preAutoHeightLayout;
|
|
270
|
+
needUpdateLayout = true;
|
|
271
|
+
}
|
|
272
|
+
if (adjustedLayouts.current[widgetId] !== postAutoHeightLayout) {
|
|
273
|
+
adjustedLayouts.current[widgetId] = postAutoHeightLayout;
|
|
274
|
+
needUpdateLayout = true;
|
|
275
|
+
}
|
|
276
|
+
if (needUpdateLayout) {
|
|
277
|
+
forceUpdateLayout((prev) => prev + 1);
|
|
269
278
|
}
|
|
270
|
-
adjustedLayouts.current[widgetId] = postAutoHeightLayout;
|
|
271
|
-
forceUpdateLayout((prev) => prev + 1);
|
|
272
279
|
}, []);
|
|
273
280
|
const revertToOriginalLayout = react_1.default.useCallback((widgetId) => {
|
|
281
|
+
const needUpdateLayout = widgetId in adjustedLayouts.current || widgetId in originalLayouts.current;
|
|
274
282
|
delete adjustedLayouts.current[widgetId];
|
|
275
283
|
delete originalLayouts.current[widgetId];
|
|
276
|
-
|
|
284
|
+
if (needUpdateLayout) {
|
|
285
|
+
forceUpdateLayout((prev) => prev + 1);
|
|
286
|
+
}
|
|
277
287
|
}, []);
|
|
278
288
|
const itemsParams = react_1.default.useMemo(() => (0, shared_1.getItemsParams)({
|
|
279
289
|
defaultGlobalParams: props.defaultGlobalParams,
|
|
@@ -259,16 +259,26 @@ function useMemoStateContext(props) {
|
|
|
259
259
|
});
|
|
260
260
|
}, [props.config, props.itemsStateAndParams, onChange]);
|
|
261
261
|
const memorizeOriginalLayout = React.useCallback((widgetId, preAutoHeightLayout, postAutoHeightLayout) => {
|
|
262
|
+
let needUpdateLayout = false;
|
|
262
263
|
if (!(widgetId in originalLayouts.current)) {
|
|
263
264
|
originalLayouts.current[widgetId] = preAutoHeightLayout;
|
|
265
|
+
needUpdateLayout = true;
|
|
266
|
+
}
|
|
267
|
+
if (adjustedLayouts.current[widgetId] !== postAutoHeightLayout) {
|
|
268
|
+
adjustedLayouts.current[widgetId] = postAutoHeightLayout;
|
|
269
|
+
needUpdateLayout = true;
|
|
270
|
+
}
|
|
271
|
+
if (needUpdateLayout) {
|
|
272
|
+
forceUpdateLayout((prev) => prev + 1);
|
|
264
273
|
}
|
|
265
|
-
adjustedLayouts.current[widgetId] = postAutoHeightLayout;
|
|
266
|
-
forceUpdateLayout((prev) => prev + 1);
|
|
267
274
|
}, []);
|
|
268
275
|
const revertToOriginalLayout = React.useCallback((widgetId) => {
|
|
276
|
+
const needUpdateLayout = widgetId in adjustedLayouts.current || widgetId in originalLayouts.current;
|
|
269
277
|
delete adjustedLayouts.current[widgetId];
|
|
270
278
|
delete originalLayouts.current[widgetId];
|
|
271
|
-
|
|
279
|
+
if (needUpdateLayout) {
|
|
280
|
+
forceUpdateLayout((prev) => prev + 1);
|
|
281
|
+
}
|
|
272
282
|
}, []);
|
|
273
283
|
const itemsParams = React.useMemo(() => getItemsParams({
|
|
274
284
|
defaultGlobalParams: props.defaultGlobalParams,
|