astro-loader-pocketbase 2.7.0 → 2.7.1-next.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -95,14 +95,16 @@ export async function cleanupEntries(
|
|
|
95
95
|
|
|
96
96
|
let cleanedUp = 0;
|
|
97
97
|
|
|
98
|
-
//
|
|
99
|
-
const storedIds =
|
|
100
|
-
.values()
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
98
|
+
// Create a mapping from PocketBase IDs to store keys for proper cleanup
|
|
99
|
+
const storedIds = new Map<string, string>(
|
|
100
|
+
context.store.values().map((entry) => [entry.data.id as string, entry.id])
|
|
101
|
+
);
|
|
102
|
+
|
|
103
|
+
// Check which PocketBase IDs are missing from the server response
|
|
104
|
+
for (const [pocketbaseId, storeKey] of storedIds.entries()) {
|
|
105
|
+
// If the PocketBase ID is not in the entries set, remove the entry from the store
|
|
106
|
+
if (!entries.has(pocketbaseId)) {
|
|
107
|
+
context.store.delete(storeKey);
|
|
106
108
|
cleanedUp++;
|
|
107
109
|
}
|
|
108
110
|
}
|