From a139a295167a7487051ea36be2dee05407fe6455 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADctor=20Velarde?= Date: Thu, 16 Apr 2020 21:21:08 +0200 Subject: [PATCH] Fix sort for dataset table --- NEWS.md | 3 ++- lib/assets/javascripts/builder/components/table/table-view.js | 2 ++ lib/assets/javascripts/builder/data/query-rows-collection.js | 2 ++ 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/NEWS.md b/NEWS.md index 37c3b7d37f..444467811d 100644 --- a/NEWS.md +++ b/NEWS.md @@ -31,7 +31,8 @@ Development - Validate email only on change ([#15575](https://github.com/CartoDB/cartodb/pull/15575)) - Fix viewer user creation from UI ([#15580](https://github.com/CartoDB/cartodb/pull/15580)) - Set node 10.15.1 as default and only for building assets, removing 6.9.2 ([#15530](https://github.com/CartoDB/cartodb/issues/15530)) -- Update toolkit libraries to fix case sensitive field iss ([#15569](https://github.com/CartoDB/cartodb/pull/15569)) +- Update toolkit libraries to fix case sensitive fields ([#15569](https://github.com/CartoDB/cartodb/pull/15569)) +- Fix to avoid locks when sorting rows in dataset table ([#2399](https://github.com/CartoDB/support/issues/2399)) 4.36.0 (2020-03-09) ------------------- diff --git a/lib/assets/javascripts/builder/components/table/table-view.js b/lib/assets/javascripts/builder/components/table/table-view.js index cd2571af4c..fb3abe23ae 100755 --- a/lib/assets/javascripts/builder/components/table/table-view.js +++ b/lib/assets/javascripts/builder/components/table/table-view.js @@ -68,6 +68,8 @@ module.exports = CoreView.extend({ this.listenTo(this._querySchemaModel, 'change:query change:status', _.debounce(this._onChangeQueryOrStatus, 100)); this.listenTo(this._querySchemaModel, 'change:status', this._setDisableState); this.listenTo(this._querySchemaModel, 'change:query', this._onQueryChanged); + + this._fetchRowsData = _.debounce(this._fetchRowsData, 100); this.listenTo(this._querySchemaModel, 'change:status', this._fetchRowsData); this.listenTo(this._tableViewModel, 'change:sort_order change:order_by', this._fetchRowsData); diff --git a/lib/assets/javascripts/builder/data/query-rows-collection.js b/lib/assets/javascripts/builder/data/query-rows-collection.js index 4045f03b2a..ede8b3e5b0 100755 --- a/lib/assets/javascripts/builder/data/query-rows-collection.js +++ b/lib/assets/javascripts/builder/data/query-rows-collection.js @@ -200,6 +200,8 @@ module.exports = Backbone.Collection.extend({ }, fetch: function (opts) { + if (this.isFetching()) return; + opts = opts || {}; var previousStatus = this.getStatusValue();