Skip to content

Commit

Permalink
Illiar/fix/v2 adjustments (#3007)
Browse files Browse the repository at this point in the history
* fix: adjusted delays & fixed date picker events

* fix: adjusted validator params & fixed revision

* feat: bumped ui & lock fix
  • Loading branch information
chesterkmr authored Jan 29, 2025
1 parent 4780ac8 commit 15a2af8
Show file tree
Hide file tree
Showing 9 changed files with 21 additions and 83 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ interface ICollectionFlowUIProps<TValues = CollectionFlowContext> {
}

const validationParams = {
validateOnBlur: true,
abortEarly: true,
validationDelay: 200,
validateOnBlur: false,
abortEarly: false,
validationDelay: 500,
};

export const CollectionFlowUI: FunctionComponent<ICollectionFlowUIProps> = ({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export const generatePriorityFields = (
// Extracting revision reason fro documents isnt common so we handling it explicitly
if (isDocumentFieldDefinition(element)) {
const documents = get(context, formatValueDestination(element.valueDestination, stack));
const document = documents.find(
const document = documents?.find(
(doc: TDocument) => doc.id === element.params?.template?.id,
);

Expand Down
1 change: 1 addition & 0 deletions packages/ui/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

### Patch Changes

- Param adjustmetns & bugfixes
- Format ongoing summary in the UI

## 0.5.69
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,8 @@ export const DatePickerInput = ({
),
inputProps: {
'data-test-id': testId,
onBlur: onBlur,
onFocus: onFocus,
},
InputProps: {
className: 'focus:outline-none',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ export const createOrUpdateFileIdOrFileInDocuments = (
return documents;
} else {
const existingDocumentIndex = documents.findIndex(document => document.id === template?.id);
documents[existingDocumentIndex] = structuredClone(template);
const pathToFileId = composePathToFileId(existingDocumentIndex, pageProperty, pageIndex);

set(documents, pathToFileId, fileIdOrFile);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export const useField = <TValue>(element: IFormElement<any, any>, stack?: TDeept
const disabledRulesResult = useRuleEngine(valuesAndMetadata, {
rules: useRules(element.disable, stack),
runOnInitialize: true,
executionDelay: 500,
executionDelay: 100,
});

const isDisabled = useMemo(() => {
Expand All @@ -38,13 +38,12 @@ export const useField = <TValue>(element: IFormElement<any, any>, stack?: TDeept
const onChange = useCallback(
<TValue>(value: TValue, ignoreEvent = false) => {
setValue(fieldId, valueDestination, value);
setTouched(fieldId, true);

if (!ignoreEvent) {
sendEventAsync('onChange');
}
},
[fieldId, valueDestination, setValue, setTouched, sendEventAsync],
[fieldId, valueDestination, setValue, sendEventAsync],
);

const onBlur = useCallback(() => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,6 @@ describe('useField', () => {
result.current.onChange('new-value');

expect(mockSetValue).toHaveBeenCalledWith('test-field-1-2', 'test.path[1][2]', 'new-value');
expect(mockSetTouched).toHaveBeenCalledWith('test-field-1-2', true);
expect(mockSendEventAsync).toHaveBeenCalledWith('onChange');
});

Expand Down Expand Up @@ -274,7 +273,7 @@ describe('useField', () => {
{
rules: mockElement.disable,
runOnInitialize: true,
executionDelay: 500,
executionDelay: 100,
},
);
});
Expand All @@ -296,7 +295,7 @@ describe('useField', () => {
{
rules: mockElement.disable,
runOnInitialize: true,
executionDelay: 500,
executionDelay: 100,
},
);
});
Expand Down
80 changes: 8 additions & 72 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion services/workflows-service/prisma/data-migrations

0 comments on commit 15a2af8

Please sign in to comment.