Fix a few edge cases with v1 views

This commit is contained in:
Andrew Kingston 2024-08-23 13:41:35 +01:00
parent 0dd432f286
commit 8d87395a98
No known key found for this signature in database
3 changed files with 8 additions and 5 deletions

View File

@ -48,7 +48,9 @@
$: datasource = $datasources.list.find(ds => ds._id === table?.sourceId)
$: tableSelectedBy = $userSelectedResourceMap[table?._id]
$: tableEditable = table?._id !== TableNames.USERS
$: activeId = $params.viewName ?? $params.viewId ?? $params.tableId
$: activeId = decodeURIComponent(
$params.viewName ?? $params.viewId ?? $params.tableId
)
$: views = Object.values(table?.views || {})
.filter(x => x.version === 2)
.slice()

View File

@ -17,9 +17,9 @@
let loading = false
$: view = $views.selected
$: name = view.name
$: schema = view.schema
$: calculation = view.calculation
$: name = view?.name
$: schema = view?.schema
$: calculation = view?.calculation
$: supportedFormats = Object.values(ROW_EXPORT_FORMATS).filter(key => {
if (calculation && key === ROW_EXPORT_FORMATS.JSON_WITH_SCHEMA) {
return false
@ -28,7 +28,7 @@
})
// Fetch rows for specified view
$: fetchViewData(name, view.field, view.groupBy, view.calculation)
$: fetchViewData(name, view?.field, view?.groupBy, view?.calculation)
async function fetchViewData(name, field, groupBy, calculation) {
loading = true

View File

@ -41,6 +41,7 @@ export function createViewsStore() {
const save = async view => {
const savedView = await API.saveView(view)
select(view.name)
// Update tables
tables.update(state => {