osl-base-extended 1.1.49 → 1.1.50

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;
@@ -2656,9 +2657,17 @@ class OslSetup {
2656
2657
  if (this.searchbar) {
2657
2658
  this.searchbar.searchControl.setValue(state.searchValue, { emitEvent: false });
2658
2659
  }
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.
2660
+ // Trigger the same code path as a real search so the parent re-fetches with the correct
2661
+ // page + searchValue in a single unified eventno new events, no application changes needed.
2662
+ if (state.searchValue) {
2663
+ this._isRestoring = true;
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;