Skip to content

Commit 35ff1a3

Browse files
committed
[sveltekit] Use escapeRegex from sjsf lib
1 parent 8796b48 commit 35ff1a3

File tree

3 files changed

+3
-5
lines changed

3 files changed

+3
-5
lines changed

packages/sveltekit/src/lib/server/schema-value-parser.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import jsonpointer from 'jsonpointer';
22
import { isObject } from '@sjsf/form/lib/object';
3+
import { escapeRegex } from '@sjsf/form/lib/reg-exp';
34
import {
45
getClosestMatchingOption2,
56
getDiscriminatorFieldFromSchema,
@@ -383,7 +384,3 @@ function* getKnownProperties(
383384
function removePseudoElements<T>(entries: Entries<T>, idPseudoSeparator: string) {
384385
return entries.filter(([key]) => key.lastIndexOf(idPseudoSeparator) === -1);
385386
}
386-
387-
function escapeRegex(str: string) {
388-
return str.replace(/[/\-\\^$*+?.()|[\]{}]/g, '\\$&');
389-
}

packages/sveltekit/src/routes/+page.server.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ const schema: Schema = {
3232
};
3333

3434
export const load = async () => {
35-
const form = initForm({ schema, validator, sendSchema: true });
35+
const form = initForm({ initialValue: { "newKey::123": "foo" }, schema, validator, sendSchema: true });
3636
return { form };
3737
};
3838

packages/sveltekit/src/routes/+page.svelte

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
translation,
1616
onSuccess: console.log,
1717
onFailure: console.warn,
18+
onSubmitError: console.error,
1819
additionalPropertyKeyValidationError({ separators }) {
1920
return `The content of these sequences ("${separators.join('", "')}") is prohibited`;
2021
}

0 commit comments

Comments
 (0)