fix: add viewFieldGroupId to ViewField fragment and connect page layout selectors to live metadata store (#18676)
This commit is contained in:
File diff suppressed because one or more lines are too long
@@ -1,7 +0,0 @@
|
||||
import { type PageLayout } from '@/page-layout/types/PageLayout';
|
||||
import { createAtomState } from '@/ui/utilities/state/jotai/utils/createAtomState';
|
||||
|
||||
export const recordPageLayoutsState = createAtomState<PageLayout[]>({
|
||||
key: 'recordPageLayoutsState',
|
||||
defaultValue: [],
|
||||
});
|
||||
+7
-4
@@ -1,6 +1,7 @@
|
||||
import { recordPageLayoutsState } from '@/page-layout/states/recordPageLayoutsState';
|
||||
import { pageLayoutsWithRelationsSelector } from '@/page-layout/states/pageLayoutsWithRelationsSelector';
|
||||
import { type PageLayout } from '@/page-layout/types/PageLayout';
|
||||
import { createAtomFamilySelector } from '@/ui/utilities/state/jotai/utils/createAtomFamilySelector';
|
||||
import { PageLayoutType } from '~/generated-metadata/graphql';
|
||||
|
||||
export const recordPageLayoutByObjectMetadataIdFamilySelector =
|
||||
createAtomFamilySelector<
|
||||
@@ -11,10 +12,12 @@ export const recordPageLayoutByObjectMetadataIdFamilySelector =
|
||||
get:
|
||||
({ objectMetadataId }) =>
|
||||
({ get }) => {
|
||||
const recordPageLayouts = get(recordPageLayoutsState);
|
||||
const pageLayouts = get(pageLayoutsWithRelationsSelector);
|
||||
|
||||
return recordPageLayouts.find(
|
||||
(pageLayout) => pageLayout.objectMetadataId === objectMetadataId,
|
||||
return pageLayouts.find(
|
||||
(pageLayout) =>
|
||||
pageLayout.type === PageLayoutType.RECORD_PAGE &&
|
||||
pageLayout.objectMetadataId === objectMetadataId,
|
||||
);
|
||||
},
|
||||
});
|
||||
|
||||
+7
-4
@@ -1,6 +1,7 @@
|
||||
import { recordPageLayoutsState } from '@/page-layout/states/recordPageLayoutsState';
|
||||
import { pageLayoutsWithRelationsSelector } from '@/page-layout/states/pageLayoutsWithRelationsSelector';
|
||||
import { type PageLayout } from '@/page-layout/types/PageLayout';
|
||||
import { createAtomFamilySelector } from '@/ui/utilities/state/jotai/utils/createAtomFamilySelector';
|
||||
import { PageLayoutType } from '~/generated-metadata/graphql';
|
||||
|
||||
export const recordPageLayoutFromIdFamilySelector = createAtomFamilySelector<
|
||||
PageLayout | undefined,
|
||||
@@ -10,10 +11,12 @@ export const recordPageLayoutFromIdFamilySelector = createAtomFamilySelector<
|
||||
get:
|
||||
({ pageLayoutId }) =>
|
||||
({ get }) => {
|
||||
const recordPageLayouts = get(recordPageLayoutsState);
|
||||
const pageLayouts = get(pageLayoutsWithRelationsSelector);
|
||||
|
||||
return recordPageLayouts.find(
|
||||
(pageLayout) => pageLayout.id === pageLayoutId,
|
||||
return pageLayouts.find(
|
||||
(pageLayout) =>
|
||||
pageLayout.type === PageLayoutType.RECORD_PAGE &&
|
||||
pageLayout.id === pageLayoutId,
|
||||
);
|
||||
},
|
||||
});
|
||||
|
||||
@@ -9,6 +9,7 @@ export const VIEW_FIELD_FRAGMENT = gql`
|
||||
position
|
||||
size
|
||||
aggregateOperation
|
||||
viewFieldGroupId
|
||||
isOverridden
|
||||
createdAt
|
||||
updatedAt
|
||||
|
||||
Reference in New Issue
Block a user