Browse Source

fix: avoid mutating hooks meta object, handle consecutive checkbox click

re #809, #734

Signed-off-by: Pranav C <pranavxc@gmail.com>
pull/764/head
Pranav C 3 years ago
parent
commit
1cbaaab6bf
  1. 58
      packages/nc-gui/components/project/spreadsheet/components/editableCell.vue
  2. 12
      packages/nc-gui/components/project/spreadsheet/rowsXcDataTable.vue
  3. 2
      packages/nc-gui/components/project/tableTabs/webhooks.vue
  4. 2
      packages/nocodb/src/lib/dataMapper/lib/sql/BaseModelSql.ts

58
packages/nc-gui/components/project/spreadsheet/components/editableCell.vue

@ -167,28 +167,11 @@ export default {
},
data: () => ({
changed: false,
destroyed: false
}),
mounted() {
// this.$refs.input.focus();
},
beforeDestroy() {
if (this.changed && !(this.isAttachment || this.isEnum || this.isBoolean || this.isSet || this.isTime)) {
this.$emit('change')
}
this.destroyed = true
},
methods: {
destroyed: false,
syncDataDebounce: debounce(async function(self) {
await self.syncData()
}, 1000),
syncData() {
if (!this.destroyed) {
this.$emit('update')
}
}
},
}, 500)
}),
computed: {
localState: {
get() {
@ -196,7 +179,10 @@ export default {
},
set(val) {
this.changed = true
if (val !== this.value) { this.syncDataDebounce(this) }
if (val !== this.value) {
// debugger
this.syncDataDebounce(this)
}
this.$emit('input', val)
}
},
@ -221,6 +207,23 @@ export default {
return $listeners
}
},
mounted() {
// this.$refs.input.focus();
},
beforeDestroy() {
if (this.changed && !(this.isAttachment || this.isEnum || this.isBoolean || this.isSet || this.isTime)) {
this.$emit('change')
}
this.destroyed = true
},
methods: {
syncData() {
if (!this.destroyed) {
this.$emit('update')
}
}
}
}
</script>
@ -232,21 +235,22 @@ div {
color: var(--v-textColor-base);
}
.nc-hint{
.nc-hint {
font-size: .61rem;
color:grey;
color: grey;
}
.nc-cell {
position: relative;
}
position: relative;
}
.nc-locked-overlay {
position: absolute;
z-index: 2;
height: 100%;
width: 100%;
top:0;
left:0;
top: 0;
left: 0;
}
</style>
<!--

12
packages/nc-gui/components/project/spreadsheet/rowsXcDataTable.vue

@ -597,6 +597,12 @@ export default {
showTabs: [Boolean, Number]
},
data: () => ({
syncDataDebounce: debounce(async function(self) {
await self.syncData()
}, 500),
loadTableDataDeb: debounce(async function(self) {
await self.loadTableDataFn()
}, 200),
viewKey: 0,
extraViewParams: {},
debug: false,
@ -779,9 +785,6 @@ export default {
this.$refs.ncgridview.xcAuditModelCommentsCount()
}
},
syncDataDebounce: debounce(async function(self) {
await self.syncData()
}, 500),
async syncData() {
if (this.relation) {
return
@ -1102,9 +1105,6 @@ export default {
}
}
},
loadTableDataDeb: debounce(async function(self) {
await self.loadTableDataFn()
}, 200),
loadTableData() {
this.loadTableDataDeb(this)
},

2
packages/nc-gui/components/project/tableTabs/webhooks.vue

@ -529,7 +529,7 @@ export default {
type
}
}
this.enableCondition = !!this.hook.condition
this.enableCondition = !!(this.hook && Object.keys(this.hook.condition).length)
await this.onNotTypeChange()
this.notification = payload
if (this.hook.notification.type === 'Slack') {

2
packages/nocodb/src/lib/dataMapper/lib/sql/BaseModelSql.ts

@ -2165,7 +2165,7 @@ class BaseModelSql extends BaseModel {
);
obj.offset = Math.max(+(args.offset || args.o) || 0, 0);
obj.fields = args.fields || args.f || '*';
obj.sort = args.sort || args.s;
obj.sort = args.sort || args.s || this.pks?.[0]?.cn;
return obj;
}

Loading…
Cancel
Save