payload 0.14.20-beta.0 → 0.14.21-beta.0

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,8 +1,9 @@
1
- ## [0.14.20-beta.0](https://github.com/payloadcms/payload/compare/v0.14.0...v0.14.20-beta.0) (2022-02-03)
1
+ ## [0.14.21-beta.0](https://github.com/payloadcms/payload/compare/v0.14.0...v0.14.21-beta.0) (2022-02-03)
2
2
 
3
3
 
4
4
  ### Bug Fixes
5
5
 
6
+ * [#422](https://github.com/payloadcms/payload/issues/422), prevents loading duplicative relationship options ([414679d](https://github.com/payloadcms/payload/commit/414679d86aac7ed94970a6eee14ff77b65f5c1d1))
6
7
  * [#423](https://github.com/payloadcms/payload/issues/423), [#391](https://github.com/payloadcms/payload/issues/391) - prevents loading edit views until data initializes ([2884654](https://github.com/payloadcms/payload/commit/28846547afc7e7bb8accc5dbe9f3b98593f332fa))
7
8
  * [#424](https://github.com/payloadcms/payload/issues/424), unable to clear localized property vals ([1a05fe4](https://github.com/payloadcms/payload/commit/1a05fe448c0755438dedc20c95d4a6a587912e2f))
8
9
  * awaits beforeDelete hooks ([609b871](https://github.com/payloadcms/payload/commit/609b871fa274e8b6d9eaf301e52ab42179aad9b7))
@@ -28,40 +29,13 @@
28
29
  * exposes useLocale for reuse ([bef0206](https://github.com/payloadcms/payload/commit/bef02062e769d1b0279c51af748f06d41c924c8a))
29
30
  * rich text indent PoC ([2deed8b](https://github.com/payloadcms/payload/commit/2deed8b1464931c4bc76a288923b307cf04b6a4a))
30
31
 
31
- ## [0.14.19-beta.0](https://github.com/payloadcms/payload/compare/v0.14.0...v0.14.19-beta.0) (2022-02-03)
32
+ ## [0.14.20-beta.0](https://github.com/payloadcms/payload/compare/v0.14.0...v0.14.20-beta.0) (2022-02-03)
32
33
 
33
34
 
34
35
  ### Bug Fixes
35
36
 
36
37
  * [#423](https://github.com/payloadcms/payload/issues/423), [#391](https://github.com/payloadcms/payload/issues/391) - prevents loading edit views until data initializes ([2884654](https://github.com/payloadcms/payload/commit/28846547afc7e7bb8accc5dbe9f3b98593f332fa))
37
- * awaits beforeDelete hooks ([609b871](https://github.com/payloadcms/payload/commit/609b871fa274e8b6d9eaf301e52ab42179aad9b7))
38
- * ensures multipart/form-data using _payload flattens field data before sending ([ae44727](https://github.com/payloadcms/payload/commit/ae44727fb9734fc3801f7249fa9e78668311c09e))
39
- * ensures nested lists always render properly ([20e5dfb](https://github.com/payloadcms/payload/commit/20e5dfbb4ab8dab320d60772f5195c5faffe38d3))
40
- * ensures rte upload is populated when only upload is enabled ([39438b8](https://github.com/payloadcms/payload/commit/39438b8460f853f64d84436eed49dde74cd207d2))
41
- * import path for createRichTextRelationshipPromise ([586cd4d](https://github.com/payloadcms/payload/commit/586cd4d6af5485116ebb299a5af3d24f5baeaa2e))
42
- * new slate version types ([c5de01b](https://github.com/payloadcms/payload/commit/c5de01bfc48ca6793c1526499fe934d9ad8f0cc9))
43
- * rte upload field population ([8327b5a](https://github.com/payloadcms/payload/commit/8327b5aae505a189a5b9617c3485d646b5f8b517))
44
- * type error in useField ([ef4e6d3](https://github.com/payloadcms/payload/commit/ef4e6d32a90215c07aa2c1e7217cf53558bfae97))
45
-
46
-
47
- ### Features
48
-
49
- * add before and after login components ([#427](https://github.com/payloadcms/payload/issues/427)) ([5591eea](https://github.com/payloadcms/payload/commit/5591eeafca1aa6e8abcc2d8276f7478e00b75ef2))
50
- * adds a way to customize express.static options ([dbb3c50](https://github.com/payloadcms/payload/commit/dbb3c502227597ef4d04c9e5c8db6d2f51a8aac4))
51
- * adds admin.upload.collections[collection-name].fields to the RTE to save specific data on upload elements ([3adf44a](https://github.com/payloadcms/payload/commit/3adf44a24162e5adbcebdb0ca7d0d460d23c57eb))
52
- * adds indentation controls to rich text ([7df50f9](https://github.com/payloadcms/payload/commit/7df50f9bf9d4867e65bdd8cebdf43e0ab1737a63))
53
- * adds recursion to richText field to populate relationship and upload nested fields ([42af22c](https://github.com/payloadcms/payload/commit/42af22c2a10de44555bfedf902e7b4a4c9b25d6b))
54
- * builds a way for multipart/form-data reqs to retain non-string values ([65b0ad7](https://github.com/payloadcms/payload/commit/65b0ad7f084a9c279a1e4fb799542f97c645653d))
55
- * enhances rich text upload with custom field API ([0e4eb90](https://github.com/payloadcms/payload/commit/0e4eb906f2881dca518fea6b41e460bc57da9801))
56
- * exposes FieldWithPath type for reuse ([df3a836](https://github.com/payloadcms/payload/commit/df3a83634fcb64724ef239600e3af4fc295fee4f))
57
- * exposes useLocale for reuse ([bef0206](https://github.com/payloadcms/payload/commit/bef02062e769d1b0279c51af748f06d41c924c8a))
58
- * rich text indent PoC ([2deed8b](https://github.com/payloadcms/payload/commit/2deed8b1464931c4bc76a288923b307cf04b6a4a))
59
-
60
- ## [0.14.18-beta.0](https://github.com/payloadcms/payload/compare/v0.14.0...v0.14.18-beta.0) (2022-02-01)
61
-
62
-
63
- ### Bug Fixes
64
-
38
+ * [#424](https://github.com/payloadcms/payload/issues/424), unable to clear localized property vals ([1a05fe4](https://github.com/payloadcms/payload/commit/1a05fe448c0755438dedc20c95d4a6a587912e2f))
65
39
  * awaits beforeDelete hooks ([609b871](https://github.com/payloadcms/payload/commit/609b871fa274e8b6d9eaf301e52ab42179aad9b7))
66
40
  * ensures multipart/form-data using _payload flattens field data before sending ([ae44727](https://github.com/payloadcms/payload/commit/ae44727fb9734fc3801f7249fa9e78668311c09e))
67
41
  * ensures nested lists always render properly ([20e5dfb](https://github.com/payloadcms/payload/commit/20e5dfbb4ab8dab320d60772f5195c5faffe38d3))
@@ -127,7 +127,7 @@ const Relationship = (props) => {
127
127
  }
128
128
  }, [search]);
129
129
  const addOptionByID = useCallback(async (id, relation) => {
130
- if (!errorLoading && id !== 'null') {
130
+ if (!errorLoading && id !== 'null' && id !== null) {
131
131
  const response = await fetch(`${serverURL}${api}/${relation}/${id}?depth=0`);
132
132
  if (response.ok) {
133
133
  const data = await response.json();
@@ -7,7 +7,7 @@ const reduceToIDs = (options) => options.reduce((ids, option) => {
7
7
  }
8
8
  return [
9
9
  ...ids,
10
- option.id,
10
+ option.value,
11
11
  ];
12
12
  }, []);
13
13
  const optionsReducer = (state, action) => {
@@ -139,7 +139,9 @@ The Payload config itself, as well as all files that it requires or imports, are
139
139
 
140
140
  Payload comes with `isomorphic-fetch` installed which means that even in Node, you can use the `fetch` API just as you would within the browser. No need to import `axios` or similar, unless you want to!
141
141
 
142
- #### Re-using the Payload `babel.config.js`
142
+ #### Payload Config and Babel
143
+
144
+ The entire Payload config is transpiled automatically by Payload via `babel`.
143
145
 
144
146
  If for any reason you need to re-use the built-in Payload `babel.config.js`, you can do so by importing it as follows:
145
147
 
@@ -147,6 +149,26 @@ If for any reason you need to re-use the built-in Payload `babel.config.js`, you
147
149
  import { config } from 'payload/babel';
148
150
  ```
149
151
 
152
+ <Banner type="warning">
153
+ <strong>Note:</strong><br/>
154
+ Because the Payload config is transpiled internally, if you want to import it to share or reuse any of its properties within your own Node server's code, you need to make sure that <em>you manually transpile it</em> using <strong>babel-register</strong> or similar. For example, if you try to import your config directly into your server, your Node process will likely crash because the Payload config supports React components, TypeScript, and new ES6+ features.
155
+ </Banner>
156
+
157
+ However, you can share code, like for example your config's `serverURL` property by "hoisting" your shared properties above your config and writing any "shared" code in a module that is compatible with your Node environment.
158
+
159
+ For example, to share your `serverURL`, you could create a file like the following:
160
+
161
+ `serverURL.js`:
162
+
163
+ ```js
164
+ const serverURL = 'http://localhost:3000';
165
+
166
+ module.exports = serverURL;
167
+ ```
168
+
169
+ Then, you could import this file into both your Payload config and your server, in an effort to avoid importing your full Payload config directly into your server.
170
+
171
+
150
172
  ### TypeScript
151
173
 
152
174
  You can import config types as follows:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "payload",
3
- "version": "0.14.20-beta.0",
3
+ "version": "0.14.21-beta.0",
4
4
  "description": "Node, React and MongoDB Headless CMS and Application Framework",
5
5
  "license": "SEE LICENSE IN license.md",
6
6
  "author": {