hotfix: entityId chaos

This commit is contained in:
Josh 2022-11-02 14:32:46 +00:00
parent 55c20e9773
commit 13cf08a5b4
2 changed files with 11 additions and 1 deletions

View File

@ -1,3 +1,4 @@
/* eslint-disable no-nested-ternary */
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import React, { memo, useMemo } from 'react'; import React, { memo, useMemo } from 'react';
import { useIntl } from 'react-intl'; import { useIntl } from 'react-intl';
@ -18,6 +19,7 @@ import { connect, select, normalizeSearchResults, diffRelations, normalizeRelati
export const RelationInputDataManager = ({ export const RelationInputDataManager = ({
error, error,
componentId, componentId,
componentUid,
editable, editable,
description, description,
intlLabel, intlLabel,
@ -64,7 +66,14 @@ export const RelationInputDataManager = ({
endpoint: endpoints.search, endpoint: endpoints.search,
pageParams: { pageParams: {
...defaultParams, ...defaultParams,
entityId: isCreatingEntry ? undefined : componentId ?? initialData.id, // TODO: fix me cause this sucks
entityId: isCreatingEntry
? undefined
: componentUid && !componentId
? undefined
: !componentUid && !componentId
? initialData.id
: componentId,
pageSize: SEARCH_RESULTS_TO_DISPLAY, pageSize: SEARCH_RESULTS_TO_DISPLAY,
}, },
}, },

View File

@ -82,6 +82,7 @@ function useSelect({
return { return {
componentId, componentId,
componentUid,
queryInfos: { queryInfos: {
...queryInfos, ...queryInfos,
endpoints: { endpoints: {