payload 0.15.8 → 0.15.9

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,3 +1,10 @@
1
+ ## [0.15.9](https://github.com/payloadcms/payload/compare/v0.15.8...v0.15.9) (2022-04-20)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * intermittent blocks UI issue ([3c1dfb8](https://github.com/payloadcms/payload/commit/3c1dfb88df8651b26cb1dbc102a34cd0aad722bc))
7
+
1
8
  ## [0.15.8](https://github.com/payloadcms/payload/compare/v0.15.7...v0.15.8) (2022-04-20)
2
9
 
3
10
 
@@ -63,7 +63,7 @@ const Blocks = (props) => {
63
63
  }, [dispatchRows, dispatchFields, path]);
64
64
  const setCollapse = useCallback(async (rowID, collapsed) => {
65
65
  var _a, _b, _c;
66
- dispatchRows({ type: 'SET_COLLAPSE', rowID, collapsed });
66
+ dispatchRows({ type: 'SET_COLLAPSE', id: rowID, collapsed });
67
67
  if (preferencesKey) {
68
68
  const preferences = await getPreference(preferencesKey);
69
69
  const preferencesToSet = preferences || { fields: {} };
@@ -97,13 +97,15 @@ const Blocks = (props) => {
97
97
  // Get preferences, and once retrieved,
98
98
  // Reset rows with preferences included
99
99
  useEffect(() => {
100
- const fetchPreferences = async () => {
101
- var _a, _b;
102
- const preferences = preferencesKey ? await getPreference(preferencesKey) : undefined;
103
- const data = formContext.getDataByPath(path);
104
- dispatchRows({ type: 'SET_ALL', data: data || [], collapsedState: (_b = (_a = preferences === null || preferences === void 0 ? void 0 : preferences.fields) === null || _a === void 0 ? void 0 : _a[path]) === null || _b === void 0 ? void 0 : _b.collapsed });
105
- };
106
- fetchPreferences();
100
+ const data = formContext.getDataByPath(path);
101
+ if (Array.isArray(data)) {
102
+ const fetchPreferences = async () => {
103
+ var _a, _b;
104
+ const preferences = preferencesKey ? await getPreference(preferencesKey) : undefined;
105
+ dispatchRows({ type: 'SET_ALL', data: data || [], collapsedState: (_b = (_a = preferences === null || preferences === void 0 ? void 0 : preferences.fields) === null || _a === void 0 ? void 0 : _a[path]) === null || _b === void 0 ? void 0 : _b.collapsed });
106
+ };
107
+ fetchPreferences();
108
+ }
107
109
  }, [formContext, path, preferencesKey, getPreference]);
108
110
  // Set row count on mount and when form context is reset
109
111
  useEffect(() => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "payload",
3
- "version": "0.15.8",
3
+ "version": "0.15.9",
4
4
  "description": "Node, React and MongoDB Headless CMS and Application Framework",
5
5
  "license": "SEE LICENSE IN license.md",
6
6
  "author": {