Skip to content

Commit

Permalink
🐛 set filter active to false when deleteFilterToken is call.
Browse files Browse the repository at this point in the history
  • Loading branch information
volterra79 committed Feb 26, 2025
1 parent 80cef8e commit a8bbc35
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/map/layers/layer.js
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ const Providers = {
url: this._layer.getUrl('editing') + params,
data: JSON.stringify({
in_bbox: options.filter.bbox.join(','),
filtertoken: ApplicationState.tokens.filtertoken
filtertoken: this.getFilterToken(),
}),
contentType: 'application/json',
})
Expand Down Expand Up @@ -1240,8 +1240,8 @@ class Layer extends G3WObject {
this.state.filter.current = null // set current filter set to null
// set active filter to false
if (this.state.filter.active) { this.setFilter(false) }
this.setFilterToken(filtertoken); // pass `filtertoken` to application

this.setFilterToken(null); //force to null
ApplicationState.tokens.filtertoken = filtertoken; // pass `filtertoken` to application
} catch(e) {
console.warn(e);
}
Expand Down Expand Up @@ -1315,7 +1315,7 @@ class Layer extends G3WObject {
* @returns {*}
*/
getFilterToken() {
return ApplicationState.tokens.filtertoken;
return this.state.filter.active ? ApplicationState.tokens.filtertoken : undefined;
}

/**
Expand Down Expand Up @@ -1727,7 +1727,7 @@ class Layer extends G3WObject {
formatter,
suggest,
in_bbox,
filtertoken: ApplicationState.tokens.filtertoken
filtertoken: this.getFilterToken()
})
);

Expand Down Expand Up @@ -1876,7 +1876,7 @@ class Layer extends G3WObject {
unique,
fformatter,
ffield,
filtertoken: ApplicationState.tokens.filtertoken,
filtertoken: this.getFilterToken(),
autofilter,
page,
page_size,
Expand Down

0 comments on commit a8bbc35

Please sign in to comment.