Don't invalidate users table due to autocolumn fields in schema when hot reloading data in the client library

This commit is contained in:
Andrew Kingston 2021-10-27 08:37:51 +01:00
parent 262b238388
commit 2af3888d8a
1 changed files with 7 additions and 2 deletions

View File

@ -1,5 +1,6 @@
import { writable, get } from "svelte/store" import { writable, get } from "svelte/store"
import { fetchTableDefinition } from "../api" import { fetchTableDefinition } from "../api"
import { TableNames } from "../constants"
export const createDataSourceStore = () => { export const createDataSourceStore = () => {
const store = writable([]) const store = writable([])
@ -72,13 +73,17 @@ export const createDataSourceStore = () => {
const schema = definition?.schema const schema = definition?.schema
if (schema) { if (schema) {
Object.values(schema).forEach(fieldSchema => { Object.values(schema).forEach(fieldSchema => {
if (fieldSchema.type === "link" && fieldSchema.tableId) { if (
fieldSchema.type === "link" &&
fieldSchema.tableId &&
!fieldSchema.autocolumn
) {
invalidations.push(fieldSchema.tableId) invalidations.push(fieldSchema.tableId)
} }
}) })
} }
// Remove and dupes // Remove any dupes
invalidations = [...new Set(invalidations)] invalidations = [...new Set(invalidations)]
// Invalidate all sources // Invalidate all sources