osl-base-extended 1.1.49 → 1.1.51

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2591,6 +2591,7 @@ class OslSetup {
2591
2591
  saveLoading = false;
2592
2592
  restoredRow = null;
2593
2593
  _pendingScrollTop = null;
2594
+ _isRestoring = false;
2594
2595
  formBodyTpl;
2595
2596
  formFooterTpl;
2596
2597
  customFooterWrapperTpl;
@@ -2653,12 +2654,20 @@ class OslSetup {
2653
2654
  this.gridRef.pageSize = state.pageSize;
2654
2655
  this.gridRef.setRestorePage(state.page);
2655
2656
  }
2656
- if (this.searchbar) {
2657
+ if (this.searchbar && state.searchValue) {
2658
+ this._isRestoring = true;
2657
2659
  this.searchbar.searchControl.setValue(state.searchValue, { emitEvent: false });
2658
2660
  }
2659
- // Emit a dedicated restore event so the parent can re-fetch with the correct params.
2660
- // Existing outputs (onSearch, pageChange) are intentionally NOT touched here firing them
2661
- // automatically would cause double API calls and unexpected side effects in the application.
2661
+ // Trigger the same code path as a real search so the parent re-fetches with the correct
2662
+ // page + searchValue in a single unified eventno new events, no application changes needed.
2663
+ if (state.searchValue) {
2664
+ this.onSearchSetup(state.searchValue);
2665
+ }
2666
+ else {
2667
+ // No search was active — just restore the page via pageChange.
2668
+ this.pageChange.emit({ page: state.page, pageSize: state.pageSize, searchValue: '' });
2669
+ }
2670
+ // Also emit the dedicated restore event for apps that want fine-grained control.
2662
2671
  this.onStateRestored.emit(state);
2663
2672
  setTimeout(() => {
2664
2673
  this.restoredRow = null;
@@ -2677,6 +2686,14 @@ class OslSetup {
2677
2686
  }
2678
2687
  }
2679
2688
  onSearchSetup(event) {
2689
+ if (this._isRestoring) {
2690
+ // Called from state restore — keep the saved page, don't reset to 1
2691
+ const restoredPage = this.gridRef?.currentPage ?? 1;
2692
+ this._isRestoring = false;
2693
+ this.pageChange.emit({ page: restoredPage, pageSize: this.gridRef?.pageSize ?? this.pageSize, searchValue: event });
2694
+ this.onSearch.emit(event);
2695
+ return;
2696
+ }
2680
2697
  if (this.gridRef) {
2681
2698
  this.gridRef.clearRestorePage();
2682
2699
  this.gridRef.currentPage = 1;