Files
Davide Silvestri df68bd9339 fix (grid view): group by flickering at every change (#5043)
* revert: undo unnecessary frontend changes from f6a7d302f

Revert all frontend changes introduced in "fix: bug in public view with
hidden group by" (f6a7d302f). The backend changes from that commit are
kept as they are the actual fix for the public view bug.

The reverted frontend changes caused a regression where group bys would
flicker (disappear and reappear) when changing the group by order,
because activeGroupBys was being cleared at the start of every refresh.

* fix: public view crash when group by is added or removed

Add ViewType.forceViewRefresh() method that handles updating the view,
fields, and (for grid views) activeGroupBys atomically during a
force_view_refresh realtime event. This prevents components from
accessing fields that have been removed or haven't been added yet.

Also fix LinkRowFieldType.isEqual crashing with null/undefined values
when rows have no linked items.

* fix: inconsistency in counting hidden fields in grid view

* fix issue deleting/restoring group bys
2026-03-31 14:42:43 +02:00

78 lines
1.8 KiB
Vue

<template>
<CreateFieldContext
ref="createFieldContext"
:table="table"
:view="view"
:force-typed="forcedType"
:all-fields-in-table="allFieldsInTable"
:database="database"
@field-created="$emit('field-created', $event)"
@field-created-callback-done="updateInsertedFieldOrder"
></CreateFieldContext>
</template>
<script>
import CreateFieldContext from '@baserow/modules/database/components/field/CreateFieldContext'
export default {
name: 'InsertFieldContext',
components: { CreateFieldContext },
props: {
table: {
type: Object,
required: true,
},
view: {
type: Object,
required: true,
},
forcedType: {
type: [String, null],
required: false,
default: null,
},
fromField: {
type: Object,
required: true,
},
allFieldsInTable: {
type: Array,
required: true,
},
database: {
type: Object,
required: true,
},
},
emits: ['field-created', 'move-field'],
data() {
return {
position: 'left', // left or right
}
},
methods: {
updateInsertedFieldOrder({ newField, undoRedoActionGroupId }) {
// GridViewHead will update the order of the fields and call the backend endpoint
this.$emit('move-field', {
newField,
position: this.position,
fromField: this.fromField,
undoRedoActionGroupId,
visible: true, // when inserting a new field, it should always be visible
})
},
toggle(ref, position) {
// avoid changing the position in the middle of a fields creation
if (this.$refs.createFieldContext.loading) {
return
}
this.position = position
const toastAnchor = position === 'left' ? 'right' : 'left'
this.$refs.createFieldContext.toggle(ref, 'bottom', toastAnchor, 0)
},
},
}
</script>