1
0
Fork 0
mirror of https://gitlab.com/bramw/baserow.git synced 2025-04-24 05:03:02 +00:00
bramw_baserow/web-frontend/modules/database/mixins/viewHelpers.js

26 lines
680 B
JavaScript

export default {
methods: {
/**
* Must be called when a new field is created. It emits the refresh event when
* needed. It expects the event parameter propagated from the
* `CreateFieldContext` component.
*/
fieldCreated({ fetchNeeded, ...context }) {
const viewType = this.$registry.get('view', this.view.type)
if (
fetchNeeded ||
viewType.shouldRefreshWhenFieldCreated(
this.$registry,
this.$store,
context.newField,
this.storePrefix
)
) {
this.$emit('refresh', context)
} else if (context.callback) {
context.callback()
}
},
},
}