Skip to content
This repository has been archived by the owner on Dec 11, 2023. It is now read-only.

Commit

Permalink
[fix] unnecesssary character in error message of sf0021 (#50)
Browse files Browse the repository at this point in the history
  • Loading branch information
AsPulse authored Apr 4, 2023
1 parent 55a4700 commit c182345
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/component/sugar/use.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export function mountSugar<T, U extends SugarObject>(

const getter = (): SugarValue<T> => {
const fields = fieldsRef.current;
if (fields === undefined) throw new SugarFormError('SF0021', `Path: ${sugar.path}}`);
if (fields === undefined) throw new SugarFormError('SF0021', `Path: ${sugar.path}`);
const value = get<U>(fields);
debug('DEBUG', `Getting Value of Sugar: ${JSON.stringify(value)}, Path: ${sugar.path}`);
if (!value.success) return value;
Expand All @@ -72,13 +72,13 @@ export function mountSugar<T, U extends SugarObject>(
const setter = (value: T): void => {
debug('DEBUG', `Setting value of sugar. Path: ${sugar.path}`);
const fields = fieldsRef.current;
if (fields === undefined) throw new SugarFormError('SF0021', `Path: ${sugar.path}}`);
if (fields === undefined) throw new SugarFormError('SF0021', `Path: ${sugar.path}`);
set<U>(fields, options.reshape.deform(value), { type: 'value' });
};

const dirtyControl = ({ isDirty }: { isDirty: boolean }) : void => {
const fields = fieldsRef.current;
if (!sugar.mounted || fields === undefined) throw new SugarFormError('SF0021', `Path: ${sugar.path}}`);
if (!sugar.mounted || fields === undefined) throw new SugarFormError('SF0021', `Path: ${sugar.path}`);
if (!isDirty && Object.values(fields).some(s => s.mounted && s.isDirty)) return;
setDirty(sugar, isDirty);
};
Expand Down

0 comments on commit c182345

Please sign in to comment.