Skip to content

Commit

Permalink
Use metadataQuery instead of metadataIdsQuery
Browse files Browse the repository at this point in the history
  • Loading branch information
Jondyr committed Sep 2, 2024
1 parent 7a06c67 commit 1511731
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { useFormLayouts } from '../../../../hooks';
import { findLayoutsContainingDuplicateComponents } from '../../../../utils/formLayoutUtils';
import { useStudioEnvironmentParams } from 'app-shared/hooks/useStudioEnvironmentParams';
import { ComponentType } from 'app-shared/types/ComponentType';
import { useAppMetadataModelIdsQuery } from 'app-shared/hooks/queries/useAppMetadataModelIdsQuery';
import { useAppMetadataQuery } from 'app-development/hooks/queries';

export interface EditComponentIdRowProps {
handleComponentUpdate: (component: FormItem) => void;
Expand All @@ -29,7 +29,7 @@ export const EditComponentIdRow = ({
useLayoutSchemaQuery();

const { org, app } = useStudioEnvironmentParams();
const { data: appMetadata } = useAppMetadataModelIdsQuery(org, app);
const { data: appMetadata } = useAppMetadataQuery(org, app);
const [isViewMode, setIsViewMode] = useState(true);
const [errorMessage, setErrorMessage] = useState<string | undefined>(null);

Expand All @@ -54,7 +54,7 @@ export const EditComponentIdRow = ({
if (value !== component.id && idExists(value, formLayouts)) {
return t('ux_editor.modal_properties_component_id_not_unique_error');
}
const duplicateDatatypeId = appMetadata.find((modelId) => modelId === value);
const duplicateDatatypeId = appMetadata.dataTypes.find((modelId) => modelId.id === value);

Check failure on line 57 in frontend/packages/ux-editor/src/components/Properties/PropertiesHeader/EditComponentIdRow/EditComponentIdRow.tsx

View workflow job for this annotation

GitHub Actions / Testing

Properties › Component ID Config › saves the component when changes are made in the properties header

TypeError: Cannot read properties of undefined (reading 'find') at find (packages/ux-editor/src/components/Properties/PropertiesHeader/EditComponentIdRow/EditComponentIdRow.tsx:57:55) at validateId (packages/ux-editor/src/components/Properties/PropertiesHeader/EditComponentIdRow/EditComponentIdRow.tsx:106:18) at customValidation (libs/studio-components/src/components/StudioToggleableTextfield/StudioToggleableTextfield.tsx:33:38) at runCustomValidation (libs/studio-components/src/components/StudioToggleableTextfield/StudioToggleableTextfield.tsx:55:9) at Object.handleChange [as onChange] (libs/studio-components/src/hooks/useTextInputProps.tsx:36:5) at Object.onChange (../node_modules/@digdir/designsystemet-react/dist/cjs/components/form/Textfield/useTextfield.js:37:26) at onChange (../node_modules/@digdir/designsystemet-react/dist/cjs/components/form/Textfield/Textfield.js:94:35) at HTMLUnknownElement.callCallback (../node_modules/react-dom/cjs/react-dom.development.js:730:119) at HTMLUnknownElement.callTheUserObjectsOperation (../node_modules/jsdom/lib/jsdom/living/generated/EventListener.js:26:30) at innerInvokeEventListeners (../node_modules/jsdom/lib/jsdom/living/events/EventTarget-impl.js:350:25) at invokeEventListeners (../node_modules/jsdom/lib/jsdom/living/events/EventTarget-impl.js:286:3) at HTMLUnknownElementImpl._dispatch (../node_modules/jsdom/lib/jsdom/living/events/EventTarget-impl.js:233:9) at HTMLUnknownElementImpl.dispatchEvent (../node_modules/jsdom/lib/jsdom/living/events/EventTarget-impl.js:104:17) at HTMLUnknownElement.dispatchEvent (../node_modules/jsdom/lib/jsdom/living/generated/EventTarget.js:241:34) at Object.invokeGuardedCallbackDev (../node_modules/react-dom/cjs/react-dom.development.js:750:45) at invokeGuardedCallback (../node_modules/react-dom/cjs/react-dom.development.js:771:126) at invokeGuardedCallbackAndCatchFirstError (../node_modules/react-dom/cjs/react-dom.development.js:780:106) at executeDispatch (../node_modules/react-dom/cjs/react-dom.development.js:1672:237) at processDispatchQueueItemsInOrder (../node_modules/react-dom/cjs/react-dom.development.js:1672:1124) at processDispatchQueue (../node_modules/react-dom/cjs/react-dom.development.js:1672:1467) at dispatchEventsForPlugins (../node_modules/react-dom/cjs/react-dom.development.js:1674:300) at ../node_modules/react-dom/cjs/react-dom.development.js:1712:323 at batchedUpdates$1 (../node_modules/react-dom/cjs/react-dom.development.js:4446:410) at batchedUpdates (../node_modules/react-dom/cjs/react-dom.development.js:674:54) at dispatchEventForPluginEventSystem (../node_modules/react-dom/cjs/react-dom.development.js:1712:290) at dispatchEventWithEnableCapturePhaseSelectiveHydrationWithoutDiscreteEventReplay (../node_modules/react-dom/cjs/react-dom.development.js:1048:1988) at dispatchEvent (../node_modules/react-dom/cjs/react-dom.development.js:1048:1579) at dispatchDiscreteEvent (../node_modules/react-dom/cjs/react-dom.development.js:1048:850) at HTMLDivElement.callTheUserObjectsOperation (../node_modules/jsdom/lib/jsdom/living/generated/EventListener.js:26:30) at innerInvokeEventListeners (../node_modules/jsdom/lib/jsdom/living/events/EventTarget-impl.js:350:25) at invokeEventListeners (../node_modules/jsdom/lib/jsdom/living/events/EventTarget-impl.js:286:3) at HTMLInputElementImpl._dispatch (../node_modules/jsdom/lib/jsdom/living/events/EventTarget-impl.js:233:9) at HTMLInputElementImpl.dispatchEvent (../node_modules/jsdom/lib/jsdom/living/events/EventTarget-impl.js:104:17) at HTMLInputElement.dispatchEvent (../node_modules/jsdom/lib/jsdom/living/generated/EventTarget.js:241:34) at ../node_modules/@testing-library/user-event/dist/cjs/event/dispatchEvent.js:44:43 at ../node_modules/@testing-library/react/dist/pure.js:131:16 at ../node_modules/@testing-library/react/dist/act-compat.js:71:24 at act (../node_modules/react/cjs/react.development.js:2199:20) at ../node_modules/@testin

Check failure on line 57 in frontend/packages/ux-editor/src/components/Properties/PropertiesHeader/EditComponentIdRow/EditComponentIdRow.tsx

View workflow job for this annotation

GitHub Actions / Testing

Properties › Component ID Config › saves the component when changes are made in the properties header

TypeError: Cannot read properties of undefined (reading 'find') at find (packages/ux-editor/src/components/Properties/PropertiesHeader/EditComponentIdRow/EditComponentIdRow.tsx:57:55) at validateId (packages/ux-editor/src/components/Properties/PropertiesHeader/EditComponentIdRow/EditComponentIdRow.tsx:106:18) at customValidation (libs/studio-components/src/components/StudioToggleableTextfield/StudioToggleableTextfield.tsx:33:38) at runCustomValidation (libs/studio-components/src/components/StudioToggleableTextfield/StudioToggleableTextfield.tsx:55:9) at Object.handleChange [as onChange] (libs/studio-components/src/hooks/useTextInputProps.tsx:36:5) at Object.onChange (../node_modules/@digdir/designsystemet-react/dist/cjs/components/form/Textfield/useTextfield.js:37:26) at onChange (../node_modules/@digdir/designsystemet-react/dist/cjs/components/form/Textfield/Textfield.js:94:35) at HTMLUnknownElement.callCallback (../node_modules/react-dom/cjs/react-dom.development.js:730:119) at HTMLUnknownElement.callTheUserObjectsOperation (../node_modules/jsdom/lib/jsdom/living/generated/EventListener.js:26:30) at innerInvokeEventListeners (../node_modules/jsdom/lib/jsdom/living/events/EventTarget-impl.js:350:25) at invokeEventListeners (../node_modules/jsdom/lib/jsdom/living/events/EventTarget-impl.js:286:3) at HTMLUnknownElementImpl._dispatch (../node_modules/jsdom/lib/jsdom/living/events/EventTarget-impl.js:233:9) at HTMLUnknownElementImpl.dispatchEvent (../node_modules/jsdom/lib/jsdom/living/events/EventTarget-impl.js:104:17) at HTMLUnknownElement.dispatchEvent (../node_modules/jsdom/lib/jsdom/living/generated/EventTarget.js:241:34) at Object.invokeGuardedCallbackDev (../node_modules/react-dom/cjs/react-dom.development.js:750:45) at invokeGuardedCallback (../node_modules/react-dom/cjs/react-dom.development.js:771:126) at invokeGuardedCallbackAndCatchFirstError (../node_modules/react-dom/cjs/react-dom.development.js:780:106) at executeDispatch (../node_modules/react-dom/cjs/react-dom.development.js:1672:237) at processDispatchQueueItemsInOrder (../node_modules/react-dom/cjs/react-dom.development.js:1672:1124) at processDispatchQueue (../node_modules/react-dom/cjs/react-dom.development.js:1672:1467) at dispatchEventsForPlugins (../node_modules/react-dom/cjs/react-dom.development.js:1674:300) at ../node_modules/react-dom/cjs/react-dom.development.js:1712:323 at batchedUpdates$1 (../node_modules/react-dom/cjs/react-dom.development.js:4446:410) at batchedUpdates (../node_modules/react-dom/cjs/react-dom.development.js:674:54) at dispatchEventForPluginEventSystem (../node_modules/react-dom/cjs/react-dom.development.js:1712:290) at dispatchEventWithEnableCapturePhaseSelectiveHydrationWithoutDiscreteEventReplay (../node_modules/react-dom/cjs/react-dom.development.js:1048:1988) at dispatchEvent (../node_modules/react-dom/cjs/react-dom.development.js:1048:1579) at dispatchDiscreteEvent (../node_modules/react-dom/cjs/react-dom.development.js:1048:850) at HTMLDivElement.callTheUserObjectsOperation (../node_modules/jsdom/lib/jsdom/living/generated/EventListener.js:26:30) at innerInvokeEventListeners (../node_modules/jsdom/lib/jsdom/living/events/EventTarget-impl.js:350:25) at invokeEventListeners (../node_modules/jsdom/lib/jsdom/living/events/EventTarget-impl.js:286:3) at HTMLInputElementImpl._dispatch (../node_modules/jsdom/lib/jsdom/living/events/EventTarget-impl.js:233:9) at HTMLInputElementImpl.dispatchEvent (../node_modules/jsdom/lib/jsdom/living/events/EventTarget-impl.js:104:17) at HTMLInputElement.dispatchEvent (../node_modules/jsdom/lib/jsdom/living/generated/EventTarget.js:241:34) at ../node_modules/@testing-library/user-event/dist/cjs/event/dispatchEvent.js:44:43 at ../node_modules/@testing-library/react/dist/pure.js:131:16 at ../node_modules/@testing-library/react/dist/act-compat.js:71:24 at act (../node_modules/react/cjs/react.development.js:2199:20) at ../node_modules/@testin

Check failure on line 57 in frontend/packages/ux-editor/src/components/Properties/PropertiesHeader/EditComponentIdRow/EditComponentIdRow.tsx

View workflow job for this annotation

GitHub Actions / Testing

Properties › Component ID Config › saves the component when changes are made in the properties header

TypeError: Cannot read properties of undefined (reading 'find') at find (packages/ux-editor/src/components/Properties/PropertiesHeader/EditComponentIdRow/EditComponentIdRow.tsx:57:55) at validateId (packages/ux-editor/src/components/Properties/PropertiesHeader/EditComponentIdRow/EditComponentIdRow.tsx:106:18) at customValidation (libs/studio-components/src/components/StudioToggleableTextfield/StudioToggleableTextfield.tsx:33:38) at runCustomValidation (libs/studio-components/src/components/StudioToggleableTextfield/StudioToggleableTextfield.tsx:55:9) at Object.handleChange [as onChange] (libs/studio-components/src/hooks/useTextInputProps.tsx:36:5) at Object.onChange (../node_modules/@digdir/designsystemet-react/dist/cjs/components/form/Textfield/useTextfield.js:37:26) at onChange (../node_modules/@digdir/designsystemet-react/dist/cjs/components/form/Textfield/Textfield.js:94:35) at HTMLUnknownElement.callCallback (../node_modules/react-dom/cjs/react-dom.development.js:730:119) at HTMLUnknownElement.callTheUserObjectsOperation (../node_modules/jsdom/lib/jsdom/living/generated/EventListener.js:26:30) at innerInvokeEventListeners (../node_modules/jsdom/lib/jsdom/living/events/EventTarget-impl.js:350:25) at invokeEventListeners (../node_modules/jsdom/lib/jsdom/living/events/EventTarget-impl.js:286:3) at HTMLUnknownElementImpl._dispatch (../node_modules/jsdom/lib/jsdom/living/events/EventTarget-impl.js:233:9) at HTMLUnknownElementImpl.dispatchEvent (../node_modules/jsdom/lib/jsdom/living/events/EventTarget-impl.js:104:17) at HTMLUnknownElement.dispatchEvent (../node_modules/jsdom/lib/jsdom/living/generated/EventTarget.js:241:34) at Object.invokeGuardedCallbackDev (../node_modules/react-dom/cjs/react-dom.development.js:750:45) at invokeGuardedCallback (../node_modules/react-dom/cjs/react-dom.development.js:771:126) at invokeGuardedCallbackAndCatchFirstError (../node_modules/react-dom/cjs/react-dom.development.js:780:106) at executeDispatch (../node_modules/react-dom/cjs/react-dom.development.js:1672:237) at processDispatchQueueItemsInOrder (../node_modules/react-dom/cjs/react-dom.development.js:1672:1124) at processDispatchQueue (../node_modules/react-dom/cjs/react-dom.development.js:1672:1467) at dispatchEventsForPlugins (../node_modules/react-dom/cjs/react-dom.development.js:1674:300) at ../node_modules/react-dom/cjs/react-dom.development.js:1712:323 at batchedUpdates$1 (../node_modules/react-dom/cjs/react-dom.development.js:4446:410) at batchedUpdates (../node_modules/react-dom/cjs/react-dom.development.js:674:54) at dispatchEventForPluginEventSystem (../node_modules/react-dom/cjs/react-dom.development.js:1712:290) at dispatchEventWithEnableCapturePhaseSelectiveHydrationWithoutDiscreteEventReplay (../node_modules/react-dom/cjs/react-dom.development.js:1048:1988) at dispatchEvent (../node_modules/react-dom/cjs/react-dom.development.js:1048:1579) at dispatchDiscreteEvent (../node_modules/react-dom/cjs/react-dom.development.js:1048:850) at HTMLDivElement.callTheUserObjectsOperation (../node_modules/jsdom/lib/jsdom/living/generated/EventListener.js:26:30) at innerInvokeEventListeners (../node_modules/jsdom/lib/jsdom/living/events/EventTarget-impl.js:350:25) at invokeEventListeners (../node_modules/jsdom/lib/jsdom/living/events/EventTarget-impl.js:286:3) at HTMLInputElementImpl._dispatch (../node_modules/jsdom/lib/jsdom/living/events/EventTarget-impl.js:233:9) at HTMLInputElementImpl.dispatchEvent (../node_modules/jsdom/lib/jsdom/living/events/EventTarget-impl.js:104:17) at HTMLInputElement.dispatchEvent (../node_modules/jsdom/lib/jsdom/living/generated/EventTarget.js:241:34) at ../node_modules/@testing-library/user-event/dist/cjs/event/dispatchEvent.js:44:43 at ../node_modules/@testing-library/react/dist/pure.js:131:16 at ../node_modules/@testing-library/react/dist/act-compat.js:71:24 at act (../node_modules/react/cjs/react.development.js:2199:20) at ../node_modules/@testin

Check failure on line 57 in frontend/packages/ux-editor/src/components/Properties/PropertiesHeader/EditComponentIdRow/EditComponentIdRow.tsx

View workflow job for this annotation

GitHub Actions / Testing

Properties › Component ID Config › saves the component when changes are made in the properties header

TypeError: Cannot read properties of undefined (reading 'find') at find (packages/ux-editor/src/components/Properties/PropertiesHeader/EditComponentIdRow/EditComponentIdRow.tsx:57:55) at validateId (packages/ux-editor/src/components/Properties/PropertiesHeader/EditComponentIdRow/EditComponentIdRow.tsx:106:18) at customValidation (libs/studio-components/src/components/StudioToggleableTextfield/StudioToggleableTextfield.tsx:33:38) at runCustomValidation (libs/studio-components/src/components/StudioToggleableTextfield/StudioToggleableTextfield.tsx:55:9) at Object.handleChange [as onChange] (libs/studio-components/src/hooks/useTextInputProps.tsx:36:5) at Object.onChange (../node_modules/@digdir/designsystemet-react/dist/cjs/components/form/Textfield/useTextfield.js:37:26) at onChange (../node_modules/@digdir/designsystemet-react/dist/cjs/components/form/Textfield/Textfield.js:94:35) at HTMLUnknownElement.callCallback (../node_modules/react-dom/cjs/react-dom.development.js:730:119) at HTMLUnknownElement.callTheUserObjectsOperation (../node_modules/jsdom/lib/jsdom/living/generated/EventListener.js:26:30) at innerInvokeEventListeners (../node_modules/jsdom/lib/jsdom/living/events/EventTarget-impl.js:350:25) at invokeEventListeners (../node_modules/jsdom/lib/jsdom/living/events/EventTarget-impl.js:286:3) at HTMLUnknownElementImpl._dispatch (../node_modules/jsdom/lib/jsdom/living/events/EventTarget-impl.js:233:9) at HTMLUnknownElementImpl.dispatchEvent (../node_modules/jsdom/lib/jsdom/living/events/EventTarget-impl.js:104:17) at HTMLUnknownElement.dispatchEvent (../node_modules/jsdom/lib/jsdom/living/generated/EventTarget.js:241:34) at Object.invokeGuardedCallbackDev (../node_modules/react-dom/cjs/react-dom.development.js:750:45) at invokeGuardedCallback (../node_modules/react-dom/cjs/react-dom.development.js:771:126) at invokeGuardedCallbackAndCatchFirstError (../node_modules/react-dom/cjs/react-dom.development.js:780:106) at executeDispatch (../node_modules/react-dom/cjs/react-dom.development.js:1672:237) at processDispatchQueueItemsInOrder (../node_modules/react-dom/cjs/react-dom.development.js:1672:1124) at processDispatchQueue (../node_modules/react-dom/cjs/react-dom.development.js:1672:1467) at dispatchEventsForPlugins (../node_modules/react-dom/cjs/react-dom.development.js:1674:300) at ../node_modules/react-dom/cjs/react-dom.development.js:1712:323 at batchedUpdates$1 (../node_modules/react-dom/cjs/react-dom.development.js:4446:410) at batchedUpdates (../node_modules/react-dom/cjs/react-dom.development.js:674:54) at dispatchEventForPluginEventSystem (../node_modules/react-dom/cjs/react-dom.development.js:1712:290) at dispatchEventWithEnableCapturePhaseSelectiveHydrationWithoutDiscreteEventReplay (../node_modules/react-dom/cjs/react-dom.development.js:1048:1988) at dispatchEvent (../node_modules/react-dom/cjs/react-dom.development.js:1048:1579) at dispatchDiscreteEvent (../node_modules/react-dom/cjs/react-dom.development.js:1048:850) at HTMLDivElement.callTheUserObjectsOperation (../node_modules/jsdom/lib/jsdom/living/generated/EventListener.js:26:30) at innerInvokeEventListeners (../node_modules/jsdom/lib/jsdom/living/events/EventTarget-impl.js:350:25) at invokeEventListeners (../node_modules/jsdom/lib/jsdom/living/events/EventTarget-impl.js:286:3) at HTMLInputElementImpl._dispatch (../node_modules/jsdom/lib/jsdom/living/events/EventTarget-impl.js:233:9) at HTMLInputElementImpl.dispatchEvent (../node_modules/jsdom/lib/jsdom/living/events/EventTarget-impl.js:104:17) at HTMLInputElement.dispatchEvent (../node_modules/jsdom/lib/jsdom/living/generated/EventTarget.js:241:34) at ../node_modules/@testing-library/user-event/dist/cjs/event/dispatchEvent.js:44:43 at ../node_modules/@testing-library/react/dist/pure.js:131:16 at ../node_modules/@testing-library/react/dist/act-compat.js:71:24 at act (../node_modules/react/cjs/react.development.js:2199:20) at ../node_modules/@testin

Check failure on line 57 in frontend/packages/ux-editor/src/components/Properties/PropertiesHeader/EditComponentIdRow/EditComponentIdRow.tsx

View workflow job for this annotation

GitHub Actions / Testing

Properties › Component ID Config › saves the component when changes are made in the properties header

TypeError: Cannot read properties of undefined (reading 'find') at find (packages/ux-editor/src/components/Properties/PropertiesHeader/EditComponentIdRow/EditComponentIdRow.tsx:57:55) at validateId (packages/ux-editor/src/components/Properties/PropertiesHeader/EditComponentIdRow/EditComponentIdRow.tsx:106:18) at customValidation (libs/studio-components/src/components/StudioToggleableTextfield/StudioToggleableTextfield.tsx:33:38) at runCustomValidation (libs/studio-components/src/components/StudioToggleableTextfield/StudioToggleableTextfield.tsx:55:9) at Object.handleChange [as onChange] (libs/studio-components/src/hooks/useTextInputProps.tsx:36:5) at Object.onChange (../node_modules/@digdir/designsystemet-react/dist/cjs/components/form/Textfield/useTextfield.js:37:26) at onChange (../node_modules/@digdir/designsystemet-react/dist/cjs/components/form/Textfield/Textfield.js:94:35) at HTMLUnknownElement.callCallback (../node_modules/react-dom/cjs/react-dom.development.js:730:119) at HTMLUnknownElement.callTheUserObjectsOperation (../node_modules/jsdom/lib/jsdom/living/generated/EventListener.js:26:30) at innerInvokeEventListeners (../node_modules/jsdom/lib/jsdom/living/events/EventTarget-impl.js:350:25) at invokeEventListeners (../node_modules/jsdom/lib/jsdom/living/events/EventTarget-impl.js:286:3) at HTMLUnknownElementImpl._dispatch (../node_modules/jsdom/lib/jsdom/living/events/EventTarget-impl.js:233:9) at HTMLUnknownElementImpl.dispatchEvent (../node_modules/jsdom/lib/jsdom/living/events/EventTarget-impl.js:104:17) at HTMLUnknownElement.dispatchEvent (../node_modules/jsdom/lib/jsdom/living/generated/EventTarget.js:241:34) at Object.invokeGuardedCallbackDev (../node_modules/react-dom/cjs/react-dom.development.js:750:45) at invokeGuardedCallback (../node_modules/react-dom/cjs/react-dom.development.js:771:126) at invokeGuardedCallbackAndCatchFirstError (../node_modules/react-dom/cjs/react-dom.development.js:780:106) at executeDispatch (../node_modules/react-dom/cjs/react-dom.development.js:1672:237) at processDispatchQueueItemsInOrder (../node_modules/react-dom/cjs/react-dom.development.js:1672:1124) at processDispatchQueue (../node_modules/react-dom/cjs/react-dom.development.js:1672:1467) at dispatchEventsForPlugins (../node_modules/react-dom/cjs/react-dom.development.js:1674:300) at ../node_modules/react-dom/cjs/react-dom.development.js:1712:323 at batchedUpdates$1 (../node_modules/react-dom/cjs/react-dom.development.js:4446:410) at batchedUpdates (../node_modules/react-dom/cjs/react-dom.development.js:674:54) at dispatchEventForPluginEventSystem (../node_modules/react-dom/cjs/react-dom.development.js:1712:290) at dispatchEventWithEnableCapturePhaseSelectiveHydrationWithoutDiscreteEventReplay (../node_modules/react-dom/cjs/react-dom.development.js:1048:1988) at dispatchEvent (../node_modules/react-dom/cjs/react-dom.development.js:1048:1579) at dispatchDiscreteEvent (../node_modules/react-dom/cjs/react-dom.development.js:1048:850) at HTMLDivElement.callTheUserObjectsOperation (../node_modules/jsdom/lib/jsdom/living/generated/EventListener.js:26:30) at innerInvokeEventListeners (../node_modules/jsdom/lib/jsdom/living/events/EventTarget-impl.js:350:25) at invokeEventListeners (../node_modules/jsdom/lib/jsdom/living/events/EventTarget-impl.js:286:3) at HTMLInputElementImpl._dispatch (../node_modules/jsdom/lib/jsdom/living/events/EventTarget-impl.js:233:9) at HTMLInputElementImpl.dispatchEvent (../node_modules/jsdom/lib/jsdom/living/events/EventTarget-impl.js:104:17) at HTMLInputElement.dispatchEvent (../node_modules/jsdom/lib/jsdom/living/generated/EventTarget.js:241:34) at ../node_modules/@testing-library/user-event/dist/cjs/event/dispatchEvent.js:44:43 at ../node_modules/@testing-library/react/dist/pure.js:131:16 at ../node_modules/@testing-library/react/dist/act-compat.js:71:24 at act (../node_modules/react/cjs/react.development.js:2199:20) at ../node_modules/@testin

Check failure on line 57 in frontend/packages/ux-editor/src/components/Properties/PropertiesHeader/EditComponentIdRow/EditComponentIdRow.tsx

View workflow job for this annotation

GitHub Actions / Testing

Properties › Component ID Config › saves the component when changes are made in the properties header

TypeError: Cannot read properties of undefined (reading 'find') at find (packages/ux-editor/src/components/Properties/PropertiesHeader/EditComponentIdRow/EditComponentIdRow.tsx:57:55) at validateId (packages/ux-editor/src/components/Properties/PropertiesHeader/EditComponentIdRow/EditComponentIdRow.tsx:106:18) at customValidation (libs/studio-components/src/components/StudioToggleableTextfield/StudioToggleableTextfield.tsx:33:38) at runCustomValidation (libs/studio-components/src/components/StudioToggleableTextfield/StudioToggleableTextfield.tsx:55:9) at Object.handleChange [as onChange] (libs/studio-components/src/hooks/useTextInputProps.tsx:36:5) at Object.onChange (../node_modules/@digdir/designsystemet-react/dist/cjs/components/form/Textfield/useTextfield.js:37:26) at onChange (../node_modules/@digdir/designsystemet-react/dist/cjs/components/form/Textfield/Textfield.js:94:35) at HTMLUnknownElement.callCallback (../node_modules/react-dom/cjs/react-dom.development.js:730:119) at HTMLUnknownElement.callTheUserObjectsOperation (../node_modules/jsdom/lib/jsdom/living/generated/EventListener.js:26:30) at innerInvokeEventListeners (../node_modules/jsdom/lib/jsdom/living/events/EventTarget-impl.js:350:25) at invokeEventListeners (../node_modules/jsdom/lib/jsdom/living/events/EventTarget-impl.js:286:3) at HTMLUnknownElementImpl._dispatch (../node_modules/jsdom/lib/jsdom/living/events/EventTarget-impl.js:233:9) at HTMLUnknownElementImpl.dispatchEvent (../node_modules/jsdom/lib/jsdom/living/events/EventTarget-impl.js:104:17) at HTMLUnknownElement.dispatchEvent (../node_modules/jsdom/lib/jsdom/living/generated/EventTarget.js:241:34) at Object.invokeGuardedCallbackDev (../node_modules/react-dom/cjs/react-dom.development.js:750:45) at invokeGuardedCallback (../node_modules/react-dom/cjs/react-dom.development.js:771:126) at invokeGuardedCallbackAndCatchFirstError (../node_modules/react-dom/cjs/react-dom.development.js:780:106) at executeDispatch (../node_modules/react-dom/cjs/react-dom.development.js:1672:237) at processDispatchQueueItemsInOrder (../node_modules/react-dom/cjs/react-dom.development.js:1672:1124) at processDispatchQueue (../node_modules/react-dom/cjs/react-dom.development.js:1672:1467) at dispatchEventsForPlugins (../node_modules/react-dom/cjs/react-dom.development.js:1674:300) at ../node_modules/react-dom/cjs/react-dom.development.js:1712:323 at batchedUpdates$1 (../node_modules/react-dom/cjs/react-dom.development.js:4446:410) at batchedUpdates (../node_modules/react-dom/cjs/react-dom.development.js:674:54) at dispatchEventForPluginEventSystem (../node_modules/react-dom/cjs/react-dom.development.js:1712:290) at dispatchEventWithEnableCapturePhaseSelectiveHydrationWithoutDiscreteEventReplay (../node_modules/react-dom/cjs/react-dom.development.js:1048:1988) at dispatchEvent (../node_modules/react-dom/cjs/react-dom.development.js:1048:1579) at dispatchDiscreteEvent (../node_modules/react-dom/cjs/react-dom.development.js:1048:850) at HTMLDivElement.callTheUserObjectsOperation (../node_modules/jsdom/lib/jsdom/living/generated/EventListener.js:26:30) at innerInvokeEventListeners (../node_modules/jsdom/lib/jsdom/living/events/EventTarget-impl.js:350:25) at invokeEventListeners (../node_modules/jsdom/lib/jsdom/living/events/EventTarget-impl.js:286:3) at HTMLInputElementImpl._dispatch (../node_modules/jsdom/lib/jsdom/living/events/EventTarget-impl.js:233:9) at HTMLInputElementImpl.dispatchEvent (../node_modules/jsdom/lib/jsdom/living/events/EventTarget-impl.js:104:17) at HTMLInputElement.dispatchEvent (../node_modules/jsdom/lib/jsdom/living/generated/EventTarget.js:241:34) at ../node_modules/@testing-library/user-event/dist/cjs/event/dispatchEvent.js:44:43 at ../node_modules/@testing-library/react/dist/pure.js:131:16 at ../node_modules/@testing-library/react/dist/act-compat.js:71:24 at act (../node_modules/react/cjs/react.development.js:2199:20) at ../node_modules/@testin

Check failure on line 57 in frontend/packages/ux-editor/src/components/Properties/PropertiesHeader/EditComponentIdRow/EditComponentIdRow.tsx

View workflow job for this annotation

GitHub Actions / Testing

Properties › Component ID Config › saves the component when changes are made in the properties header

TypeError: Cannot read properties of undefined (reading 'find') at find (packages/ux-editor/src/components/Properties/PropertiesHeader/EditComponentIdRow/EditComponentIdRow.tsx:57:55) at validateId (packages/ux-editor/src/components/Properties/PropertiesHeader/EditComponentIdRow/EditComponentIdRow.tsx:106:18) at customValidation (libs/studio-components/src/components/StudioToggleableTextfield/StudioToggleableTextfield.tsx:33:38) at runCustomValidation (libs/studio-components/src/components/StudioToggleableTextfield/StudioToggleableTextfield.tsx:55:9) at Object.handleChange [as onChange] (libs/studio-components/src/hooks/useTextInputProps.tsx:36:5) at Object.onChange (../node_modules/@digdir/designsystemet-react/dist/cjs/components/form/Textfield/useTextfield.js:37:26) at onChange (../node_modules/@digdir/designsystemet-react/dist/cjs/components/form/Textfield/Textfield.js:94:35) at HTMLUnknownElement.callCallback (../node_modules/react-dom/cjs/react-dom.development.js:730:119) at HTMLUnknownElement.callTheUserObjectsOperation (../node_modules/jsdom/lib/jsdom/living/generated/EventListener.js:26:30) at innerInvokeEventListeners (../node_modules/jsdom/lib/jsdom/living/events/EventTarget-impl.js:350:25) at invokeEventListeners (../node_modules/jsdom/lib/jsdom/living/events/EventTarget-impl.js:286:3) at HTMLUnknownElementImpl._dispatch (../node_modules/jsdom/lib/jsdom/living/events/EventTarget-impl.js:233:9) at HTMLUnknownElementImpl.dispatchEvent (../node_modules/jsdom/lib/jsdom/living/events/EventTarget-impl.js:104:17) at HTMLUnknownElement.dispatchEvent (../node_modules/jsdom/lib/jsdom/living/generated/EventTarget.js:241:34) at Object.invokeGuardedCallbackDev (../node_modules/react-dom/cjs/react-dom.development.js:750:45) at invokeGuardedCallback (../node_modules/react-dom/cjs/react-dom.development.js:771:126) at invokeGuardedCallbackAndCatchFirstError (../node_modules/react-dom/cjs/react-dom.development.js:780:106) at executeDispatch (../node_modules/react-dom/cjs/react-dom.development.js:1672:237) at processDispatchQueueItemsInOrder (../node_modules/react-dom/cjs/react-dom.development.js:1672:1124) at processDispatchQueue (../node_modules/react-dom/cjs/react-dom.development.js:1672:1467) at dispatchEventsForPlugins (../node_modules/react-dom/cjs/react-dom.development.js:1674:300) at ../node_modules/react-dom/cjs/react-dom.development.js:1712:323 at batchedUpdates$1 (../node_modules/react-dom/cjs/react-dom.development.js:4446:410) at batchedUpdates (../node_modules/react-dom/cjs/react-dom.development.js:674:54) at dispatchEventForPluginEventSystem (../node_modules/react-dom/cjs/react-dom.development.js:1712:290) at dispatchEventWithEnableCapturePhaseSelectiveHydrationWithoutDiscreteEventReplay (../node_modules/react-dom/cjs/react-dom.development.js:1048:1988) at dispatchEvent (../node_modules/react-dom/cjs/react-dom.development.js:1048:1579) at dispatchDiscreteEvent (../node_modules/react-dom/cjs/react-dom.development.js:1048:850) at HTMLDivElement.callTheUserObjectsOperation (../node_modules/jsdom/lib/jsdom/living/generated/EventListener.js:26:30) at innerInvokeEventListeners (../node_modules/jsdom/lib/jsdom/living/events/EventTarget-impl.js:350:25) at invokeEventListeners (../node_modules/jsdom/lib/jsdom/living/events/EventTarget-impl.js:286:3) at HTMLInputElementImpl._dispatch (../node_modules/jsdom/lib/jsdom/living/events/EventTarget-impl.js:233:9) at HTMLInputElementImpl.dispatchEvent (../node_modules/jsdom/lib/jsdom/living/events/EventTarget-impl.js:104:17) at HTMLInputElement.dispatchEvent (../node_modules/jsdom/lib/jsdom/living/generated/EventTarget.js:241:34) at ../node_modules/@testing-library/user-event/dist/cjs/event/dispatchEvent.js:44:43 at ../node_modules/@testing-library/react/dist/pure.js:131:16 at ../node_modules/@testing-library/react/dist/act-compat.js:71:24 at act (../node_modules/react/cjs/react.development.js:2199:20) at ../node_modules/@testin

Check failure on line 57 in frontend/packages/ux-editor/src/components/Properties/PropertiesHeader/EditComponentIdRow/EditComponentIdRow.tsx

View workflow job for this annotation

GitHub Actions / Testing

Properties › Component ID Config › saves the component when changes are made in the properties header

TypeError: Cannot read properties of undefined (reading 'find') at find (packages/ux-editor/src/components/Properties/PropertiesHeader/EditComponentIdRow/EditComponentIdRow.tsx:57:55) at validateId (packages/ux-editor/src/components/Properties/PropertiesHeader/EditComponentIdRow/EditComponentIdRow.tsx:106:18) at customValidation (libs/studio-components/src/components/StudioToggleableTextfield/StudioToggleableTextfield.tsx:33:38) at runCustomValidation (libs/studio-components/src/components/StudioToggleableTextfield/StudioToggleableTextfield.tsx:55:9) at Object.handleChange [as onChange] (libs/studio-components/src/hooks/useTextInputProps.tsx:36:5) at Object.onChange (../node_modules/@digdir/designsystemet-react/dist/cjs/components/form/Textfield/useTextfield.js:37:26) at onChange (../node_modules/@digdir/designsystemet-react/dist/cjs/components/form/Textfield/Textfield.js:94:35) at HTMLUnknownElement.callCallback (../node_modules/react-dom/cjs/react-dom.development.js:730:119) at HTMLUnknownElement.callTheUserObjectsOperation (../node_modules/jsdom/lib/jsdom/living/generated/EventListener.js:26:30) at innerInvokeEventListeners (../node_modules/jsdom/lib/jsdom/living/events/EventTarget-impl.js:350:25) at invokeEventListeners (../node_modules/jsdom/lib/jsdom/living/events/EventTarget-impl.js:286:3) at HTMLUnknownElementImpl._dispatch (../node_modules/jsdom/lib/jsdom/living/events/EventTarget-impl.js:233:9) at HTMLUnknownElementImpl.dispatchEvent (../node_modules/jsdom/lib/jsdom/living/events/EventTarget-impl.js:104:17) at HTMLUnknownElement.dispatchEvent (../node_modules/jsdom/lib/jsdom/living/generated/EventTarget.js:241:34) at Object.invokeGuardedCallbackDev (../node_modules/react-dom/cjs/react-dom.development.js:750:45) at invokeGuardedCallback (../node_modules/react-dom/cjs/react-dom.development.js:771:126) at invokeGuardedCallbackAndCatchFirstError (../node_modules/react-dom/cjs/react-dom.development.js:780:106) at executeDispatch (../node_modules/react-dom/cjs/react-dom.development.js:1672:237) at processDispatchQueueItemsInOrder (../node_modules/react-dom/cjs/react-dom.development.js:1672:1124) at processDispatchQueue (../node_modules/react-dom/cjs/react-dom.development.js:1672:1467) at dispatchEventsForPlugins (../node_modules/react-dom/cjs/react-dom.development.js:1674:300) at ../node_modules/react-dom/cjs/react-dom.development.js:1712:323 at batchedUpdates$1 (../node_modules/react-dom/cjs/react-dom.development.js:4446:410) at batchedUpdates (../node_modules/react-dom/cjs/react-dom.development.js:674:54) at dispatchEventForPluginEventSystem (../node_modules/react-dom/cjs/react-dom.development.js:1712:290) at dispatchEventWithEnableCapturePhaseSelectiveHydrationWithoutDiscreteEventReplay (../node_modules/react-dom/cjs/react-dom.development.js:1048:1988) at dispatchEvent (../node_modules/react-dom/cjs/react-dom.development.js:1048:1579) at dispatchDiscreteEvent (../node_modules/react-dom/cjs/react-dom.development.js:1048:850) at HTMLDivElement.callTheUserObjectsOperation (../node_modules/jsdom/lib/jsdom/living/generated/EventListener.js:26:30) at innerInvokeEventListeners (../node_modules/jsdom/lib/jsdom/living/events/EventTarget-impl.js:350:25) at invokeEventListeners (../node_modules/jsdom/lib/jsdom/living/events/EventTarget-impl.js:286:3) at HTMLInputElementImpl._dispatch (../node_modules/jsdom/lib/jsdom/living/events/EventTarget-impl.js:233:9) at HTMLInputElementImpl.dispatchEvent (../node_modules/jsdom/lib/jsdom/living/events/EventTarget-impl.js:104:17) at HTMLInputElement.dispatchEvent (../node_modules/jsdom/lib/jsdom/living/generated/EventTarget.js:241:34) at ../node_modules/@testing-library/user-event/dist/cjs/event/dispatchEvent.js:44:43 at ../node_modules/@testing-library/react/dist/pure.js:131:16 at ../node_modules/@testing-library/react/dist/act-compat.js:71:24 at act (../node_modules/react/cjs/react.development.js:2199:20) at ../node_modules/@testin

Check failure on line 57 in frontend/packages/ux-editor/src/components/Properties/PropertiesHeader/EditComponentIdRow/EditComponentIdRow.tsx

View workflow job for this annotation

GitHub Actions / Testing

Properties › Component ID Config › saves the component when changes are made in the properties header

Expected test not to call console.error(). If the error is expected, test for it explicitly by mocking it out using jest.spyOn(console, 'error').mockImplementation() and test that the warning occurs. Error: Uncaught [TypeError: Cannot read properties of undefined (reading 'find')] at reportException (../node_modules/jsdom/lib/jsdom/living/helpers/runtime-script-errors.js:66:24) at innerInvokeEventListeners (../node_modules/jsdom/lib/jsdom/living/events/EventTarget-impl.js:353:9) at invokeEventListeners (../node_modules/jsdom/lib/jsdom/living/events/EventTarget-impl.js:286:3) at HTMLUnknownElementImpl._dispatch (../node_modules/jsdom/lib/jsdom/living/events/EventTarget-impl.js:233:9) at HTMLUnknownElementImpl.dispatchEvent (../node_modules/jsdom/lib/jsdom/living/events/EventTarget-impl.js:104:17) at HTMLUnknownElement.dispatchEvent (../node_modules/jsdom/lib/jsdom/living/generated/EventTarget.js:241:34) at Object.invokeGuardedCallbackDev (../node_modules/react-dom/cjs/react-dom.development.js:750:45) at invokeGuardedCallback (../node_modules/react-dom/cjs/react-dom.development.js:771:126) at invokeGuardedCallbackAndCatchFirstError (../node_modules/react-dom/cjs/react-dom.development.js:780:106) at executeDispatch (../node_modules/react-dom/cjs/react-dom.development.js:1672:237) at processDispatchQueueItemsInOrder (../node_modules/react-dom/cjs/react-dom.development.js:1672:1124) at processDispatchQueue (../node_modules/react-dom/cjs/react-dom.development.js:1672:1467) at dispatchEventsForPlugins (../node_modules/react-dom/cjs/react-dom.development.js:1674:300) at ../node_modules/react-dom/cjs/react-dom.development.js:1712:323 at batchedUpdates$1 (../node_modules/react-dom/cjs/react-dom.development.js:4446:410) at batchedUpdates (../node_modules/react-dom/cjs/react-dom.development.js:674:54) at dispatchEventForPluginEventSystem (../node_modules/react-dom/cjs/react-dom.development.js:1712:290) at dispatchEventWithEnableCapturePhaseSelectiveHydrationWithoutDiscreteEventReplay (../node_modules/react-dom/cjs/react-dom.development.js:1048:1988) at dispatchEvent (../node_modules/react-dom/cjs/react-dom.development.js:1048:1579) at dispatchDiscreteEvent (../node_modules/react-dom/cjs/react-dom.development.js:1048:850) at HTMLDivElement.callTheUserObjectsOperation (../node_modules/jsdom/lib/jsdom/living/generated/EventListener.js:26:30) at innerInvokeEventListeners (../node_modules/jsdom/lib/jsdom/living/events/EventTarget-impl.js:350:25) at invokeEventListeners (../node_modules/jsdom/lib/jsdom/living/events/EventTarget-impl.js:286:3) at HTMLInputElementImpl._dispatch (../node_modules/jsdom/lib/jsdom/living/events/EventTarget-impl.js:233:9) at HTMLInputElementImpl.dispatchEvent (../node_modules/jsdom/lib/jsdom/living/events/EventTarget-impl.js:104:17) at HTMLInputElement.dispatchEvent (../node_modules/jsdom/lib/jsdom/living/generated/EventTarget.js:241:34) at ../node_modules/@testing-library/user-event/dist/cjs/event/dispatchEvent.js:44:43 at ../node_modules/@testing-library/react/dist/pure.js:131:16 at ../node_modules/@testing-library/react/dist/act-compat.js:71:24 at act (../node_modules/react/cjs/react.development.js:2199:20) at ../node_modules/@testing-library/react/dist/act-compat.js:70:25 at Object.eventWrapper (../node_modules/@testing-library/react/dist/pure.js:130:28) at Object.wrapEvent (../node_modules/@testing-library/user-event/dist/cjs/event/wrapEvent.js:5:26) at Object.dispatchEvent (../node_modules/@testing-library/user-event/dist/cjs/event/dispatchEvent.js:44:20) at Object.dispatchUIEvent (../node_modules/@testing-library/user-event/dist/cjs/event/dispatchEvent.js:21:24) at commitInput (../node_modules/@testing-library/user-event/dist/cjs/event/input.js:151:12) at editInputElement (../node_modules/@testing-library/user-event/dist/cjs/event/input.js:118:5) at Object.input (../node_modules/@testing-library/user-event/dist/cjs/event/input.js:39:5) at ../node_mo

Check failure on line 57 in frontend/packages/ux-editor/src/components/Properties/PropertiesHeader/EditComponentIdRow/EditComponentIdRow.tsx

View workflow job for this annotation

GitHub Actions / Testing

Properties › Component ID Config › should not invoke handleUpdate when the id is invalid

TypeError: Cannot read properties of undefined (reading 'find') at find (packages/ux-editor/src/components/Properties/PropertiesHeader/EditComponentIdRow/EditComponentIdRow.tsx:57:55) at validateId (packages/ux-editor/src/components/Properties/PropertiesHeader/EditComponentIdRow/EditComponentIdRow.tsx:106:18) at customValidation (libs/studio-components/src/components/StudioToggleableTextfield/StudioToggleableTextfield.tsx:33:38) at runCustomValidation (libs/studio-components/src/components/StudioToggleableTextfield/StudioToggleableTextfield.tsx:55:9) at Object.handleChange [as onChange] (libs/studio-components/src/hooks/useTextInputProps.tsx:36:5) at Object.onChange (../node_modules/@digdir/designsystemet-react/dist/cjs/components/form/Textfield/useTextfield.js:37:26) at onChange (../node_modules/@digdir/designsystemet-react/dist/cjs/components/form/Textfield/Textfield.js:94:35) at HTMLUnknownElement.callCallback (../node_modules/react-dom/cjs/react-dom.development.js:730:119) at HTMLUnknownElement.callTheUserObjectsOperation (../node_modules/jsdom/lib/jsdom/living/generated/EventListener.js:26:30) at innerInvokeEventListeners (../node_modules/jsdom/lib/jsdom/living/events/EventTarget-impl.js:350:25) at invokeEventListeners (../node_modules/jsdom/lib/jsdom/living/events/EventTarget-impl.js:286:3) at HTMLUnknownElementImpl._dispatch (../node_modules/jsdom/lib/jsdom/living/events/EventTarget-impl.js:233:9) at HTMLUnknownElementImpl.dispatchEvent (../node_modules/jsdom/lib/jsdom/living/events/EventTarget-impl.js:104:17) at HTMLUnknownElement.dispatchEvent (../node_modules/jsdom/lib/jsdom/living/generated/EventTarget.js:241:34) at Object.invokeGuardedCallbackDev (../node_modules/react-dom/cjs/react-dom.development.js:750:45) at invokeGuardedCallback (../node_modules/react-dom/cjs/react-dom.development.js:771:126) at invokeGuardedCallbackAndCatchFirstError (../node_modules/react-dom/cjs/react-dom.development.js:780:106) at executeDispatch (../node_modules/react-dom/cjs/react-dom.development.js:1672:237) at processDispatchQueueItemsInOrder (../node_modules/react-dom/cjs/react-dom.development.js:1672:1124) at processDispatchQueue (../node_modules/react-dom/cjs/react-dom.development.js:1672:1467) at dispatchEventsForPlugins (../node_modules/react-dom/cjs/react-dom.development.js:1674:300) at ../node_modules/react-dom/cjs/react-dom.development.js:1712:323 at batchedUpdates$1 (../node_modules/react-dom/cjs/react-dom.development.js:4446:410) at batchedUpdates (../node_modules/react-dom/cjs/react-dom.development.js:674:54) at dispatchEventForPluginEventSystem (../node_modules/react-dom/cjs/react-dom.development.js:1712:290) at dispatchEventWithEnableCapturePhaseSelectiveHydrationWithoutDiscreteEventReplay (../node_modules/react-dom/cjs/react-dom.development.js:1048:1988) at dispatchEvent (../node_modules/react-dom/cjs/react-dom.development.js:1048:1579) at dispatchDiscreteEvent (../node_modules/react-dom/cjs/react-dom.development.js:1048:850) at HTMLDivElement.callTheUserObjectsOperation (../node_modules/jsdom/lib/jsdom/living/generated/EventListener.js:26:30) at innerInvokeEventListeners (../node_modules/jsdom/lib/jsdom/living/events/EventTarget-impl.js:350:25) at invokeEventListeners (../node_modules/jsdom/lib/jsdom/living/events/EventTarget-impl.js:286:3) at HTMLInputElementImpl._dispatch (../node_modules/jsdom/lib/jsdom/living/events/EventTarget-impl.js:233:9) at HTMLInputElementImpl.dispatchEvent (../node_modules/jsdom/lib/jsdom/living/events/EventTarget-impl.js:104:17) at HTMLInputElement.dispatchEvent (../node_modules/jsdom/lib/jsdom/living/generated/EventTarget.js:241:34) at ../node_modules/@testing-library/user-event/dist/cjs/event/dispatchEvent.js:44:43 at ../node_modules/@testing-library/react/dist/pure.js:131:16 at ../node_modules/@testing-library/react/dist/act-compat.js:71:24 at act (../node_modules/react/cjs/react.development.js:2199:20) at ../node_modules/@testin
if (
value !== component.id &&
(component.type === ComponentType.FileUpload ||
Expand Down

0 comments on commit 1511731

Please sign in to comment.