1
0
Fork 0
mirror of https://gitlab.com/bramw/baserow.git synced 2025-04-25 21:33:41 +00:00

Fixed moved row warning responsiveness bug

This commit is contained in:
Bram Wiepjes 2023-12-21 17:08:20 +01:00
parent c49591f13d
commit 6bcd05bf4b

View file

@ -1766,10 +1766,12 @@ export const actions = {
if (isSingleRowInsertion) { if (isSingleRowInsertion) {
// When a single row is inserted we don't want to deal with filters, sorts and // When a single row is inserted we don't want to deal with filters, sorts and
// search just yet. Therefore it is okay to just insert the row into the buffer. // search just yet. Therefore it is okay to just insert the row into the buffer.
await dispatch('updateGroupByMetadataCount', { commit('UPDATE_GROUP_BY_METADATA_COUNT', {
fields, fields,
registry: this.$registry,
row: rowsPopulated[0], row: rowsPopulated[0],
increase: true, increase: true,
decrease: false,
}) })
commit('INSERT_NEW_ROWS_IN_BUFFER_AT_INDEX', { commit('INSERT_NEW_ROWS_IN_BUFFER_AT_INDEX', {
rows: rowsPopulated, rows: rowsPopulated,
@ -1854,9 +1856,11 @@ export const actions = {
}) })
} catch (error) { } catch (error) {
if (isSingleRowInsertion) { if (isSingleRowInsertion) {
await dispatch('updateGroupByMetadataCount', { commit('UPDATE_GROUP_BY_METADATA_COUNT', {
fields, fields,
registry: this.$registry,
row: rowsPopulated[0], row: rowsPopulated[0],
increase: false,
decrease: true, decrease: true,
}) })
commit('DELETE_ROW_IN_BUFFER', rowsPopulated[0]) commit('DELETE_ROW_IN_BUFFER', rowsPopulated[0])
@ -1907,10 +1911,12 @@ export const actions = {
} }
// Update the group by metadata if needed. // Update the group by metadata if needed.
await dispatch('updateGroupByMetadataCount', { commit('UPDATE_GROUP_BY_METADATA_COUNT', {
fields, fields,
registry: this.$registry,
row, row,
increase: true, increase: true,
decrease: false,
}) })
// Now that we know that the row applies to the filters, which means it belongs // Now that we know that the row applies to the filters, which means it belongs
@ -2055,19 +2061,23 @@ export const actions = {
// If the row exists in the buffer, we can visually show to the user that // If the row exists in the buffer, we can visually show to the user that
// the values have changed, without immediately reflecting the change in // the values have changed, without immediately reflecting the change in
// the buffer. // the buffer.
await dispatch('updateGroupByMetadataCount', { commit('UPDATE_GROUP_BY_METADATA_COUNT', {
fields, fields,
registry: this.$registry,
row, row,
increase: false,
decrease: true, decrease: true,
}) })
commit('UPDATE_ROW_VALUES', { commit('UPDATE_ROW_VALUES', {
row, row,
values: { ...values }, values: { ...values },
}) })
await dispatch('updateGroupByMetadataCount', { commit('UPDATE_GROUP_BY_METADATA_COUNT', {
fields, fields,
registry: this.$registry,
row, row,
increase: true, increase: true,
decrease: false,
}) })
await dispatch('onRowChange', { view, row, fields }) await dispatch('onRowChange', { view, row, fields })
} else { } else {
@ -2404,15 +2414,19 @@ export const actions = {
} else if (oldRowExists && newRowExists) { } else if (oldRowExists && newRowExists) {
// Instead of implementing a metadata updated mutation, we can easily just // Instead of implementing a metadata updated mutation, we can easily just
// call the deleted and created mutation because that will have the same effect. // call the deleted and created mutation because that will have the same effect.
await dispatch('updateGroupByMetadataCount', { commit('UPDATE_GROUP_BY_METADATA_COUNT', {
fields, fields,
registry: this.$registry,
row: oldRow, row: oldRow,
increase: false,
decrease: true, decrease: true,
}) })
await dispatch('updateGroupByMetadataCount', { commit('UPDATE_GROUP_BY_METADATA_COUNT', {
fields, fields,
registry: this.$registry,
row: newRow, row: newRow,
increase: true, increase: true,
decrease: false,
}) })
// If the new order already exists in the buffer and is not the row that has // If the new order already exists in the buffer and is not the row that has
@ -2608,9 +2622,11 @@ export const actions = {
} }
// Decrease the count in the group by metadata if an entry exists. // Decrease the count in the group by metadata if an entry exists.
await dispatch('updateGroupByMetadataCount', { commit('UPDATE_GROUP_BY_METADATA_COUNT', {
fields, fields,
registry: this.$registry,
row, row,
increase: false,
decrease: true, decrease: true,
}) })
@ -2853,29 +2869,6 @@ export const actions = {
fieldIndex: minFieldIndex, fieldIndex: minFieldIndex,
}) })
}, },
/**
* Increases or decreases the count value of the group by entries if the row
* values match the group by values.
*/
updateGroupByMetadataCount(
{ commit, getters },
{ fields, row, increase = false, decrease = false }
) {
if (increase && decrease) {
throw new Error("The group count can't be increased and decreased.")
}
if (!increase && !decrease) {
throw new Error('The group count must be increased or decreased.')
}
commit('UPDATE_GROUP_BY_METADATA_COUNT', {
fields,
registry: this.$registry,
row,
increase,
decrease,
})
},
} }
export const getters = { export const getters = {