Fix cross app installation (#18151)
# Introduction - Fixing app dependencyFlatEntityMaps load ( to load current app + dependent app ) - Fix empty flat entity maps and undefined optimistic override - Refactor the optimistic rendering to be mutation oriented at orchestrator level
This commit is contained in:
+8
-10
@@ -13,7 +13,8 @@ export type ComputeUniversalFlatEntityMapsFromToArgs<
|
||||
flatEntityMaps: MetadataUniversalFlatEntityMaps<T>;
|
||||
} & FlatEntityToCreateDeleteUpdate<T>;
|
||||
|
||||
export const computeUniversalFlatEntityMapsFromTo = <
|
||||
// Note: We don't load the whole application flat entity maps in the from for performances purposes
|
||||
export const computeUniversalFlatEntityMapsFromToThroughMutation = <
|
||||
T extends AllMetadataName,
|
||||
>({
|
||||
flatEntityMaps,
|
||||
@@ -25,15 +26,12 @@ export const computeUniversalFlatEntityMapsFromTo = <
|
||||
to: MetadataUniversalFlatEntityMaps<T>;
|
||||
} => {
|
||||
const fromFlatEntityMaps =
|
||||
flatEntityToDelete.length > 0
|
||||
? getSubUniversalFlatEntityByUniversalIdentifiersMapsOrThrow({
|
||||
universalIdentifiers: [
|
||||
...flatEntityToDelete,
|
||||
...flatEntityToUpdate,
|
||||
].map(({ universalIdentifier }) => universalIdentifier),
|
||||
universalFlatEntityMaps: flatEntityMaps,
|
||||
})
|
||||
: flatEntityMaps;
|
||||
getSubUniversalFlatEntityByUniversalIdentifiersMapsOrThrow({
|
||||
universalIdentifiers: [...flatEntityToDelete, ...flatEntityToUpdate].map(
|
||||
({ universalIdentifier }) => universalIdentifier,
|
||||
),
|
||||
universalFlatEntityMaps: flatEntityMaps,
|
||||
});
|
||||
|
||||
const toFlatEntityMaps: MetadataUniversalFlatEntityMaps<T> =
|
||||
structuredClone(fromFlatEntityMaps);
|
||||
+2
-2
@@ -1,4 +1,4 @@
|
||||
import { validateObjectMetadataSystemFieldsIntegrity } from 'src/engine/metadata-modules/flat-object-metadata/validators/utils/validate-object-metadata-system-fields-integrity';
|
||||
import { validateObjectMetadataCrossEntity } from 'src/engine/metadata-modules/flat-object-metadata/validators/utils/validate-object-metadata-cross-entity.util';
|
||||
import {
|
||||
type OrchestratorActionsReport,
|
||||
type OrchestratorFailureReport,
|
||||
@@ -12,7 +12,7 @@ export const crossEntityTransversalValidation = ({
|
||||
optimisticUniversalFlatMaps: AllUniversalFlatEntityMaps;
|
||||
orchestratorActionsReport: OrchestratorActionsReport;
|
||||
}): Pick<OrchestratorFailureReport, 'objectMetadata'> => {
|
||||
const { objectMetadata } = validateObjectMetadataSystemFieldsIntegrity({
|
||||
const { objectMetadata } = validateObjectMetadataCrossEntity({
|
||||
optimisticUniversalFlatMaps,
|
||||
orchestratorActionsReport,
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user