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 React, { memo, useMemo } from 'react';
import { useIntl } from 'react-intl';
@ -18,6 +19,7 @@ import { connect, select, normalizeSearchResults, diffRelations, normalizeRelati
export const RelationInputDataManager = ({
error,
componentId,
componentUid,
editable,
description,
intlLabel,
@ -64,7 +66,14 @@ export const RelationInputDataManager = ({
endpoint: endpoints.search,
pageParams: {
...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,
},
},

View File

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