From cdea75adbefc19a8913e772625135d5d01570583 Mon Sep 17 00:00:00 2001 From: sunhao Date: Thu, 15 Aug 2024 22:10:48 +0800 Subject: [PATCH] * [bug #53888, done, 1h] fix search-form not reload on page load. --- lib/zin/wg/searchform/v1.php | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/lib/zin/wg/searchform/v1.php b/lib/zin/wg/searchform/v1.php index a5de6875df..ff74720c31 100644 --- a/lib/zin/wg/searchform/v1.php +++ b/lib/zin/wg/searchform/v1.php @@ -51,6 +51,22 @@ class searchForm extends wg if(!$this->hasProp('url')) $this->setProp('url', createLink('search', 'buildZinForm', 'module=' . $this->prop('module'))); if(!$this->hasProp('searchUrl')) $this->setProp('searchUrl', createLink('search', 'buildZinQuery')); } - return zui::searchForm(inherit($this)); + return zui::searchForm + ( + inherit($this), + set::_children + ( + on::init()->do('$element.attr("data-last-url", $.apps.getAppUrl())'), + on::skipMorph() + ->beginIf('$.apps.getAppUrl() !== $element.attr("data-last-url")') + ->do + ( + '$element.attr("data-last-url", $.apps.getAppUrl())', + 'zui.SearchForm.get($element).$.load(true)', + 'console.log("skip morph", event);' + ) + ->endIf() + ) + ); } }