@@ -8,11 +8,27 @@ In some cases it may be necessary to transform the form state before it is passe
88
99You can do this by providing ` getSnapshot ` attribute.
1010
11+ ## Omit extra data
12+
13+ One of the transformation options you can apply is deleting unnecessary data.
14+
15+ For this you can use ` omitExtraData ` function.
16+
17+ :::note
18+
19+ Currently function ` omitExtraData ` is imported from ` @sjsf/form/legacy-omit-extra-data ` and
20+ will be deprecated because it's implementation does not meet the requirements of our code base.
21+
22+ It will be replaced with ` @sjsf/form/omit-extra-data ` import in the major release.
23+
24+ :::
25+
1126``` svelte
1227<script lang="ts">
1328 import { Form } from "@sjsf/form";
1429 import { translation } from "@sjsf/form/translations/en";
1530 import { theme } from "@sjsf/form/basic-theme";
31+ import { omitExtraData } from "@sjsf/form/legacy-omit-extra-data";
1632
1733 import { schema, uiSchema, initialData } from "./schema";
1834 import { validator } from "./validator";
@@ -28,7 +44,7 @@ You can do this by providing `getSnapshot` attribute.
2844 {uiSchema}
2945 {validator}
3046 {translation}
31- getSnapshot={() => transform( $state.snapshot(value))}
47+ getSnapshot={() => omitExtraData(validator, schema, $state.snapshot(value))}
3248 onSubmit={(value) => {
3349 console.log("transformed", value);
3450 }}
@@ -37,4 +53,4 @@ You can do this by providing `getSnapshot` attribute.
3753 console.log("transformed", value);
3854 }}
3955/>
40- ```
56+ ```
0 commit comments