Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions .github/workflows/build-test-publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,15 +48,15 @@ jobs:
run: yarn build

- name: Cache build
uses: actions/cache@v2
uses: actions/cache@v4
env:
cache-name: cache-build
id: cache-build
with:
path: ./*
key: ${{ github.sha }}
- name: Cache cypress
uses: actions/cache@v2
uses: actions/cache@v4
env:
cache-name: cache-cypress
id: cache-cypress
Expand All @@ -75,7 +75,7 @@ jobs:
with:
node-version: 14

- uses: actions/cache@v2
- uses: actions/cache@v4
id: restore-build
with:
path: ./*
Expand All @@ -94,7 +94,7 @@ jobs:
uses: actions/setup-node@v2
with:
node-version: "14"
- uses: actions/cache@v2
- uses: actions/cache@v4
id: restore-build
with:
path: ./*
Expand All @@ -112,7 +112,7 @@ jobs:
uses: actions/setup-node@v2
with:
node-version: "14"
- uses: actions/cache@v2
- uses: actions/cache@v4
id: restore-build
with:
path: ./*
Expand All @@ -128,12 +128,12 @@ jobs:
containers: [1, 2, 3, 4, 5, 6, 7]
needs: ["build", "prepare"]
steps:
- uses: actions/cache@v2
- uses: actions/cache@v4
id: restore-build
with:
path: ./*
key: ${{ github.sha }}
- uses: actions/cache@v2
- uses: actions/cache@v4
id: restore-cypress
with:
path: /home/runner/.cache/Cypress/*
Expand Down Expand Up @@ -168,7 +168,7 @@ jobs:
node-version: 14
registry-url: "https://registry.yarnpkg.com/"

- uses: actions/cache@v2
- uses: actions/cache@v4
id: restore-build
with:
path: ./*
Expand Down
15 changes: 15 additions & 0 deletions commons/src/store/manifest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,18 @@ function initialize(): Writable<ManifestStore> {
}

export const ManifestStore = initialize();

/**
* Invalidate a cached manifest entry so the next access triggers a fresh fetch.
* Call after saving a manifest to prevent stale data on re-mount.
*/
export function invalidateManifestCache(componentId: string, accessToken?: string): void {
const key = JSON.stringify({ component_id: componentId, access_token: accessToken });
ManifestStore.update((store) => {
// The store wraps a Proxy whose underlying target holds cached promises.
// Deleting the key from the store object causes the Proxy get-trap to
// re-fetch on the next access.
delete (store as Record<string, unknown>)[key];
return store;
});
}
11 changes: 9 additions & 2 deletions components/schedule-editor/src/ScheduleEditor.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import { onDestroy, onMount, tick } from "svelte";
import timezones from "timezones-list";
import { ErrorStore, ManifestStore } from "@commons";
import { invalidateManifestCache } from "@commons/store/manifest";
import { getEventDispatcher } from "@commons/methods/component";
import { saveManifest } from "@commons/connections/manifest";
import "../../availability/src/Availability.svelte";
Expand Down Expand Up @@ -201,7 +202,7 @@
}
// #endregion mount and prop initialization

function saveProperties() {
async function saveProperties() {
const cleanedProps = {
..._this,
custom_fields: _this.custom_fields.map((field) => {
Expand All @@ -210,7 +211,13 @@
}),
};

saveManifest(id, cleanedProps, access_token);
await saveManifest(id, cleanedProps, access_token);

// Invalidate the ManifestStore cache and update the local manifest so
// that both re-mounts and in-session reads reflect the saved state.
// Fixes CUST-5442: deleted custom fields reappearing after save.
invalidateManifestCache(id, access_token);
manifest = { ...cleanedProps };
}

// #region unpersisted variables
Expand Down
Loading