@budibase/frontend-core 2.7.26 → 2.7.28

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
@@ -1,17 +1,17 @@
1
1
  {
2
2
  "name": "@budibase/frontend-core",
3
- "version": "2.7.26",
3
+ "version": "2.7.28",
4
4
  "description": "Budibase frontend core libraries used in builder and client",
5
5
  "author": "Budibase",
6
6
  "license": "MPL-2.0",
7
7
  "svelte": "src/index.js",
8
8
  "dependencies": {
9
- "@budibase/bbui": "2.7.26",
10
- "@budibase/shared-core": "2.7.26",
9
+ "@budibase/bbui": "2.7.28",
10
+ "@budibase/shared-core": "2.7.28",
11
11
  "dayjs": "^1.11.7",
12
12
  "lodash": "^4.17.21",
13
13
  "socket.io-client": "^4.6.1",
14
14
  "svelte": "^3.46.2"
15
15
  },
16
- "gitHead": "5e717d1b72e72ff5acb422c0f553693a82a5b690"
16
+ "gitHead": "8595dfa6c3679ca2706a79f36bd1e18a5fa3ddf5"
17
17
  }
@@ -2,6 +2,7 @@ import { writable, derived, get } from "svelte/store"
2
2
  import { fetchData } from "../../../fetch/fetchData"
3
3
  import { notifications } from "@budibase/bbui"
4
4
  import { NewRowID, RowPageSize } from "../lib/constants"
5
+ import { tick } from "svelte"
5
6
 
6
7
  const initialSortState = {
7
8
  column: null,
@@ -124,13 +125,22 @@ export const deriveStores = context => {
124
125
  })
125
126
 
126
127
  // Subscribe to changes of this fetch model
127
- unsubscribe = newFetch.subscribe($fetch => {
128
+ unsubscribe = newFetch.subscribe(async $fetch => {
128
129
  if ($fetch.loaded && !$fetch.loading) {
129
130
  hasNextPage.set($fetch.hasNextPage)
130
131
  const $instanceLoaded = get(instanceLoaded)
131
132
  const resetRows = $fetch.resetKey !== lastResetKey
133
+ const previousResetKey = lastResetKey
132
134
  lastResetKey = $fetch.resetKey
133
135
 
136
+ // If resetting rows due to a table change, wipe data and wait for
137
+ // derived stores to compute. This prevents stale data being passed
138
+ // to cells when we save the new schema.
139
+ if (!$instanceLoaded && previousResetKey) {
140
+ rows.set([])
141
+ await tick()
142
+ }
143
+
134
144
  // Reset state properties when dataset changes
135
145
  if (!$instanceLoaded || resetRows) {
136
146
  table.set($fetch.definition)