Request state: {personParcelControl.onChangeStatus.status} - {personParcelControl.onChangeStatus.isPending && } +
Request state: {personParcelControl.submitStatus.status} + {personParcelControl.submitStatus.isPending && }
); } diff --git a/packages/dataparcels-docs/src/examples/SubmitButtonOnChangeClear.jsx b/packages/dataparcels-docs/src/examples/SubmitButtonOnChangeClear.jsx index e35ecef3..fea32555 100644 --- a/packages/dataparcels-docs/src/examples/SubmitButtonOnChangeClear.jsx +++ b/packages/dataparcels-docs/src/examples/SubmitButtonOnChangeClear.jsx @@ -25,11 +25,11 @@ export default function SignUpForm(props) { let [personParcel, personParcelControl] = useParcelForm({ value: initialValue, - onChange: async (parcel) => { + onSubmit: async (parcel) => { await saveMyData(parcel.value); return initialValue; }, - onChangeUseResult: true + onSubmitUseResult: true }); let personParcelState = personParcelControl._outerParcel; @@ -46,8 +46,8 @@ export default function SignUpForm(props) { -Request state: {personParcelControl.onChangeStatus.status} - {personParcelControl.onChangeStatus.isPending && } +
Request state: {personParcelControl.submitStatus.status} + {personParcelControl.submitStatus.isPending && }
); } diff --git a/packages/dataparcels-docs/src/examples/SubmitButtonOnChangeClearSource.txt b/packages/dataparcels-docs/src/examples/SubmitButtonOnChangeClearSource.txt index 8b06dbb0..d9a5853e 100644 --- a/packages/dataparcels-docs/src/examples/SubmitButtonOnChangeClearSource.txt +++ b/packages/dataparcels-docs/src/examples/SubmitButtonOnChangeClearSource.txt @@ -11,11 +11,11 @@ export default function SignUpForm(props) { let [personParcel, personParcelControl] = useParcelForm({ value: initialValue, - onChange: async (parcel) => { + onSubmit: async (parcel) => { await saveMyData(parcel.value); return initialValue; }, - onChangeUseResult: true + onSubmitUseResult: true }); returnRequest state: {personParcelControl.onChangeStatus.status} - {personParcelControl.onChangeStatus.isPending && } +
Request state: {personParcelControl.submitStatus.status} + {personParcelControl.submitStatus.isPending && }
{SubmitButtonOnChangeClearSource}
@@ -46,7 +46,7 @@ If you're using something like [Redux](https://redux.js.org/), you'll likely be
### Updating form data via a promise
-You may not have centralised state management like Redux in your app. In this case you can get useParcelForm to update based off the return value of the promise returned by the save function. To use this approach, set the [onChangeUseResult](/api/useParcelForm#onChangeUseResult) parameter to true.
+You may not have centralised state management like Redux in your app. In this case you can get useParcelForm to update based off the return value of the promise returned by the save function. To use this approach, set the [onSubmitUseResult](/api/useParcelForm#onSubmitUseResult) parameter to true.
{SubmitButtonOnChangeLoadSource}
diff --git a/packages/dataparcels-docs/src/pages/index.mdx b/packages/dataparcels-docs/src/pages/index.mdx
index a1b7cffe..4e7d067a 100644
--- a/packages/dataparcels-docs/src/pages/index.mdx
+++ b/packages/dataparcels-docs/src/pages/index.mdx
@@ -69,9 +69,6 @@ I hope this library helps solve some front-end problems for you.
### Roadmap
-- Add **revertable changes**. The `useParcelState.onChange` callback should be able to return promises, and this can then allow failed `onChange` calls to reinstate unsaved changes in a lower Parcel buffer. This is a crucial feature that will allow for forms to rollback when requests fail.
-- Add **data synchronisation docs**, including data sync strategies strategies with examples.
-- Add **merge mode** to control how downward changes are accepted into `ParcelBoundary` components. This is required for rekey.
- Add **rekey**, which enables changes via props to be merged into buffered changes (i.e. unsaved changes). This will allow multiple editors to alter the same piece of data simultaneously without overwriting. The ability to rebase unsaved changes onto updated data already exists, but rekey is required to make sense of incoming changes via props.
- Add **cache**, an option in `useParcelBuffer` to save, reload and clear cached data. This can be used with `localStorage` or similar external storage mechanisms to retain and restore unsaved changes.
- Add **production builds**, a proper build process that doesn't rely on minification and dead code elimination being carried out by the containing project's build process. This step will finally allow proper optimisations to reduce bundle size.
diff --git a/packages/dataparcels-docs/src/shape/ContentNav.jsx b/packages/dataparcels-docs/src/shape/ContentNav.jsx
index 41c68212..ec803bd1 100644
--- a/packages/dataparcels-docs/src/shape/ContentNav.jsx
+++ b/packages/dataparcels-docs/src/shape/ContentNav.jsx
@@ -15,9 +15,8 @@ const nav = () =>