diff --git a/CHANGELOG.md b/CHANGELOG.md index b7750ada..b9815bf7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,17 @@ +## [2.24.5](https://github.com/eeditiones/tei-publisher-components/compare/v2.24.4...v2.24.5) (2024-11-21) + + +### Bug Fixes + +* **pb-combo-box:** Clear items before refetching ([b6fdf68](https://github.com/eeditiones/tei-publisher-components/commit/b6fdf68040484df01de23ee28f6461f525ce5423)) + +## [2.24.4](https://github.com/eeditiones/tei-publisher-components/compare/v2.24.3...v2.24.4) (2024-11-14) + + +### Bug Fixes + +* **pb-table-grid:** respect existing search parameter when using included search feature ([7abdd8f](https://github.com/eeditiones/tei-publisher-components/commit/7abdd8fb67368f0a864a14354c98839e527dda94)) + ## [2.24.3](https://github.com/eeditiones/tei-publisher-components/compare/v2.24.2...v2.24.3) (2024-10-10) diff --git a/package-lock.json b/package-lock.json index dbea0fa6..4955f88b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@teipublisher/pb-components", - "version": "2.24.3", + "version": "2.24.5", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@teipublisher/pb-components", - "version": "2.24.3", + "version": "2.24.5", "license": "GPL-3.0-or-later", "dependencies": { "@babel/runtime": "7.11.2", diff --git a/package.json b/package.json index 278870ca..ff54c919 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@teipublisher/pb-components", - "version": "2.24.3", + "version": "2.24.5", "description": "Collection of webcomponents underlying TEI Publisher", "repository": "https://github.com/eeditiones/tei-publisher-components.git", "main": "index.html", diff --git a/src/pb-combo-box.js b/src/pb-combo-box.js index fcd0a8d3..3df588ab 100644 --- a/src/pb-combo-box.js +++ b/src/pb-combo-box.js @@ -63,9 +63,11 @@ export class PbComboBox extends pbMixin(LitElement) { }, /** * Preload all items from the remote data source at startup + * Must be of type string because tom-select supports setting + * that property to "focus" (load data on focus) */ preload: { - type: Boolean + type: String }, /** * Name of the event to be emitted when the user leaves the form control @@ -160,6 +162,12 @@ export class PbComboBox extends pbMixin(LitElement) { options.searchField = []; options.preload = this.preload; options.load = (query, callback) => { + if (this._select) { + // The default behaviour of tom-select is to keep existing items when loading + // again from the source. We want to show only items the server provides, so + // we need to clear "stale" items before fetching. + this._select.clearOptions(); + } fetch(`${url}?query=${encodeURIComponent(query)}`, { method: 'GET', mode: 'cors',