Skip to content

Commit

Permalink
JNG-5742 re-use draft prefix var
Browse files Browse the repository at this point in the history
  • Loading branch information
noherczeg committed Jun 10, 2024
1 parent 04a6f0f commit 6ab31c8
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { useRef, useCallback, useEffect, useState, useMemo, lazy, Suspense } fro
import { OBJECTCLASS } from '@pandino/pandino-api';
import { useTrackService } from '@pandino/react-hooks';
import type { JudoIdentifiable } from '~/services/data-api/common/JudoIdentifiable';
import { draftIdentifierPrefix } from '~/services/data-api/common/utils';
import type { JudoRestResponse } from '~/services/data-api/rest/requestResponse';
{{# if (containerHasTableWithTotalCount page.container) }}
import { X_JUDO_COUNT_RECORDS } from '~/services/data-api/rest/headers';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ const {{ simpleActionDefinitionName action.actionDefinition }} = async ({{# if a
if (result === 'submit-draft' && returnedData) {
const decoratedData = {
...returnedData,
__identifier: `draft:${uuidv4()}`,
__identifier: `${draftIdentifierPrefix}${uuidv4()}`,
};
const newData = {{# if action.targetDataElement.isCollection }}[...(data.{{ action.targetDataElement.name }} || []), decoratedData]{{ else }}decoratedData{{/ if }}
storeDiff('{{ action.targetDataElement.name }}', newData);
Expand All @@ -44,7 +44,7 @@ const {{ simpleActionDefinitionName action.actionDefinition }} = async ({{# if a
} else if (result === 'submit-draft' && returnedData) {
const decoratedData = {
...returnedData,
__identifier: `draft:${uuidv4()}`,
__identifier: `${draftIdentifierPrefix}${uuidv4()}`,
};
const newData = {{# if action.targetDataElement.isCollection }}[...(data.{{ action.targetDataElement.name }} || []), decoratedData]{{ else }}decoratedData{{/ if }}
storeDiff('{{ action.targetDataElement.name }}', newData);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { OBJECTCLASS } from '@pandino/pandino-api';
import type { FC, ReactNode, Dispatch, SetStateAction } from 'react';
import { useTrackService } from '@pandino/react-hooks';
import type { JudoIdentifiable } from '~/services/data-api/common/JudoIdentifiable';
import { draftIdentifierPrefix } from '~/services/data-api/common/utils';
import type { JudoRestResponse } from '~/services/data-api/rest/requestResponse';
{{# if (containerHasTableWithTotalCount page.container) }}
import { X_JUDO_COUNT_RECORDS } from '~/services/data-api/rest/headers';
Expand Down

0 comments on commit 6ab31c8

Please sign in to comment.