@xeplr/cli 0.3.12 → 0.3.13

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xeplr/cli",
3
- "version": "0.3.12",
3
+ "version": "0.3.13",
4
4
  "description": "Creates a working xeplr application — API, sign-in and UI — from a few answers.",
5
5
  "license": "MIT",
6
6
  "author": "xeppie <admin@xeplr.com>",
@@ -20,6 +20,18 @@ export default function FormDesigner() {
20
20
  const screenKey = form + (part === 'list' ? '_list' : '_edit')
21
21
  const [current, setCurrent] = useState(null) // { key, document, lockedNames }
22
22
  const [error, setError] = useState(null)
23
+ // BOTH SCREENS' DOCUMENTS, not just their names. The list's Columns are
24
+ // the FORM's fields, and its "Edit in" opens the form: without the form's
25
+ // document the list can offer only the columns it already has, so a field
26
+ // added to the form could never be shown in its list.
27
+ const [documents, setDocuments] = useState({})
28
+
29
+ useEffect(() => {
30
+ let cancelled = false
31
+ Promise.all(PARTS.map((p) => factory.loadDraft(form + p.suffix).then((row) => [p.part, row.document], () => [p.part, null])))
32
+ .then((pairs) => { if (!cancelled) setDocuments(Object.fromEntries(pairs)) })
33
+ return () => { cancelled = true }
34
+ }, [form, part])
23
35
 
24
36
  useEffect(() => {
25
37
  let cancelled = false
@@ -65,7 +77,7 @@ export default function FormDesigner() {
65
77
  document={current.document}
66
78
  lockedNames={current.lockedNames}
67
79
  onPublish={publish}
68
- screens={PARTS.map((p) => ({ id: form + p.suffix, name: p.label }))}
80
+ screens={PARTS.map((p) => ({ id: form + p.suffix, name: p.label, document: documents[p.part] || undefined }))}
69
81
  />
70
82
  </div>
71
83
  )}