@panneau/medias 4.0.27 → 4.0.28
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/dist/index.js +9 -8
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import _defineProperty from '@babel/runtime/helpers/defineProperty';
|
|
2
2
|
import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
|
|
3
3
|
import classNames from 'classnames';
|
|
4
|
-
import { use, useMemo, createContext, useCallback, useState,
|
|
4
|
+
import { use, useMemo, createContext, useCallback, useState, useEffect } from 'react';
|
|
5
5
|
import { FormattedMessage } from 'react-intl';
|
|
6
6
|
import { useFieldComponent, usePanneauResource } from '@panneau/core/contexts';
|
|
7
7
|
import { useForm, useQuery } from '@panneau/core/hooks';
|
|
@@ -952,18 +952,19 @@ function MediasBrowser(_ref) {
|
|
|
952
952
|
var _count;
|
|
953
953
|
return (_count = (fullQuery || {}).count) !== null && _count !== void 0 ? _count : null;
|
|
954
954
|
}, [fullQuery]);
|
|
955
|
-
|
|
956
|
-
|
|
955
|
+
|
|
956
|
+
// Stabilize the filter query reference: only create a new object when filter values actually change.
|
|
957
|
+
// We use JSON.stringify as a stable primitive key so that useMemo only recomputes when values differ.
|
|
958
|
+
var queryJSON = useMemo(function () {
|
|
957
959
|
var _ref2 = fullQuery || {};
|
|
958
960
|
_ref2.page;
|
|
959
961
|
_ref2.count;
|
|
960
962
|
var params = _objectWithoutProperties(_ref2, _excluded$5);
|
|
961
|
-
|
|
962
|
-
if (JSON.stringify(queryRef.current) !== JSON.stringify(newQuery)) {
|
|
963
|
-
queryRef.current = newQuery;
|
|
964
|
-
}
|
|
965
|
-
return queryRef.current;
|
|
963
|
+
return Object.keys(params).length > 0 ? JSON.stringify(params) : null;
|
|
966
964
|
}, [fullQuery]);
|
|
965
|
+
var query = useMemo(function () {
|
|
966
|
+
return queryJSON !== null ? JSON.parse(queryJSON) : null;
|
|
967
|
+
}, [queryJSON]);
|
|
967
968
|
var _ref3 = permissions || {},
|
|
968
969
|
_ref3$create = _ref3.create,
|
|
969
970
|
canCreate = _ref3$create === void 0 ? true : _ref3$create,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@panneau/medias",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.28",
|
|
4
4
|
"description": "",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"javascript"
|
|
@@ -77,5 +77,5 @@
|
|
|
77
77
|
"publishConfig": {
|
|
78
78
|
"access": "public"
|
|
79
79
|
},
|
|
80
|
-
"gitHead": "
|
|
80
|
+
"gitHead": "b7c6d15c677466d9cadfe956a3fa9a0cc51cc276"
|
|
81
81
|
}
|