Optimise resetting data to smoothly transition when changing datasource

This commit is contained in:
Andrew Kingston 2023-02-28 15:00:10 +00:00
parent 9be7d042a9
commit db469711cf
1 changed files with 2 additions and 2 deletions

View File

@ -25,8 +25,6 @@ export const createRowsStore = context => {
} }
// Wipe state and fully hydrate next time our fetch returns data // Wipe state and fully hydrate next time our fetch returns data
loaded = false loaded = false
rowCacheMap = {}
rows.set([])
// Create fetch and load initial data // Create fetch and load initial data
return fetchData({ return fetchData({
@ -62,6 +60,8 @@ export const createRowsStore = context => {
if (!loaded) { if (!loaded) {
// Hydrate initial data // Hydrate initial data
loaded = true loaded = true
rowCacheMap = {}
rows.set([])
schema.set($$fetch.schema) schema.set($$fetch.schema)
primaryDisplay.set($$fetch.definition?.primaryDisplay) primaryDisplay.set($$fetch.definition?.primaryDisplay)
} }