From 13a7a2257d4ecbf551c1fa0dd76a77c568317b09 Mon Sep 17 00:00:00 2001 From: Yohan Boniface Date: Fri, 4 Oct 2024 09:26:53 +0200 Subject: [PATCH] fix: do not fail in autocomplete if on_unselect is undefined --- umap/static/umap/js/modules/autocomplete.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/umap/static/umap/js/modules/autocomplete.js b/umap/static/umap/js/modules/autocomplete.js index 38ac27b7..003c82fb 100644 --- a/umap/static/umap/js/modules/autocomplete.js +++ b/umap/static/umap/js/modules/autocomplete.js @@ -313,7 +313,7 @@ export const SingleMixin = (Base) => DomEvent.on(close, 'click', () => { this.selectedContainer.innerHTML = '' this.input.style.display = 'block' - this.options.on_unselect(result) + this.options.on_unselect?.(result) }) this.hide() } @@ -342,7 +342,7 @@ export const MultipleMixin = (Base) => }) DomEvent.on(close, 'click', () => { this.selectedContainer.removeChild(result_el) - this.options.on_unselect(result) + this.options.on_unselect?.(result) }) this.hide() }