Fix compressed draft saves provenance and Beira documentary continuity
tests / ci (push) Canceled after 0s
tests / ci (push) Canceled after 0s
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import { simulationDraftEtag } from '@/lib/simulation-draft-etag';
|
||||
import { SimulationPublishedIva, type PublishedIvaInput } from './simulation-published-iva';
|
||||
import { SimulationMonthlyIva } from './simulation-monthly-iva';
|
||||
import { inheritSimulatorFields, reusedInvestmentValue } from '@/lib/context-inheritance';
|
||||
@@ -1248,7 +1249,7 @@ export function SimulationForm() {
|
||||
if (payload.data) {
|
||||
if (cancelled) return;
|
||||
draftIdRef.current = payload.data.id;
|
||||
draftEtagRef.current = response.headers.get('ETag');
|
||||
draftEtagRef.current = simulationDraftEtag(response.headers.get('ETag'));
|
||||
setDraftVersionNo(payload.data.version_no);
|
||||
setDraftExpiresAt(payload.data.expires_at ?? null);
|
||||
if (canSavePersonalData)
|
||||
@@ -1370,7 +1371,7 @@ export function SimulationForm() {
|
||||
if (currentDraft) {
|
||||
draftIdRef.current = currentDraft.id;
|
||||
draftEtagRef.current =
|
||||
currentResponse.headers.get('ETag');
|
||||
simulationDraftEtag(currentResponse.headers.get('ETag'));
|
||||
sessionStorage.setItem(draftIdKey, currentDraft.id);
|
||||
}
|
||||
}
|
||||
@@ -1432,7 +1433,7 @@ export function SimulationForm() {
|
||||
);
|
||||
draftIdRef.current = payload.data.id;
|
||||
setServerFieldErrors({});
|
||||
draftEtagRef.current = response.headers.get('ETag');
|
||||
draftEtagRef.current = simulationDraftEtag(response.headers.get('ETag'));
|
||||
setDraftVersionNo(payload.data.version_no);
|
||||
lastSavedFingerprintRef.current = fingerprint;
|
||||
sessionStorage.setItem(draftIdKey, payload.data.id);
|
||||
@@ -1593,7 +1594,7 @@ export function SimulationForm() {
|
||||
)
|
||||
throw new Error('Não foi possível abrir este dossier privado.');
|
||||
draftIdRef.current = payload.data.id;
|
||||
draftEtagRef.current = response.headers.get('ETag');
|
||||
draftEtagRef.current = simulationDraftEtag(response.headers.get('ETag'));
|
||||
setDraftVersionNo(payload.data.version_no);
|
||||
setDraftExpiresAt(null);
|
||||
setSelectedAccountDraftId(payload.data.id);
|
||||
@@ -1656,7 +1657,7 @@ export function SimulationForm() {
|
||||
);
|
||||
const record = (payload as { data: ApiSimulationDraftV1 }).data;
|
||||
draftIdRef.current = record.id;
|
||||
draftEtagRef.current = response.headers.get('ETag');
|
||||
draftEtagRef.current = simulationDraftEtag(response.headers.get('ETag'));
|
||||
setDraftVersionNo(record.version_no);
|
||||
setDraftExpiresAt(null);
|
||||
setSelectedAccountDraftId(record.id);
|
||||
@@ -1756,7 +1757,7 @@ export function SimulationForm() {
|
||||
(payload as { expires_at: string }).expires_at,
|
||||
);
|
||||
draftEtagRef.current =
|
||||
response.headers.get('ETag') ?? draftEtagRef.current;
|
||||
simulationDraftEtag(response.headers.get('ETag')) ?? draftEtagRef.current;
|
||||
}
|
||||
setContinueLaterSaved(true);
|
||||
setSaveStatus(
|
||||
@@ -2375,7 +2376,7 @@ export function SimulationForm() {
|
||||
);
|
||||
const draftId = draftIdValue;
|
||||
draftIdRef.current = draftId;
|
||||
draftEtagRef.current = currentResponse.headers.get('ETag');
|
||||
draftEtagRef.current = simulationDraftEtag(currentResponse.headers.get('ETag'));
|
||||
if (!draftEtagRef.current)
|
||||
throw new Error(
|
||||
'O servidor não devolveu a versão actual do rascunho. Recarregue e tente novamente.',
|
||||
@@ -2409,7 +2410,7 @@ export function SimulationForm() {
|
||||
throw new Error(
|
||||
'O servidor devolveu uma confirmação de anexação inválida.',
|
||||
);
|
||||
draftEtagRef.current = response.headers.get('ETag');
|
||||
draftEtagRef.current = simulationDraftEtag(response.headers.get('ETag'));
|
||||
const sources = payload.data?.simulation_sources;
|
||||
if (Array.isArray(sources)) setSimulationSources(sources);
|
||||
setDraft((currentDraft) => ({
|
||||
|
||||
Reference in New Issue
Block a user