barsa-tiles 3.0.1 → 3.0.3

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.
@@ -1984,10 +1984,14 @@ class TilesViewerService {
1984
1984
  });
1985
1985
  }
1986
1986
  loadAllAppTileGroups() {
1987
- this.tilesStore.loading.set(true);
1987
+ // گاردِ کش را «قبل» از set کردنِ loading چک می‌کنیم؛ در غیر این صورت روی هر re-initِ
1988
+ // صفحه‌ی launchpad (که دیگر route-reuse نمی‌شود)، loading روی true گیر می‌کرد چون بلافاصله
1989
+ // return می‌شود و set(false) اجرا نمی‌شود. (فعلاً بی‌اثر بود چون این سیگنال رندر نمی‌شود،
1990
+ // اما نگه‌داشتنِ state درست جلوی باگِ آینده را می‌گیرد.)
1988
1991
  if (this.tilesStore.allAppsLoading()) {
1989
1992
  return;
1990
1993
  }
1994
+ this.tilesStore.loading.set(true);
1991
1995
  this.tilesApi
1992
1996
  .loadAllAppTileGroups()
1993
1997
  .pipe(takeUntilDestroyed(this._destroyRef))
@@ -2157,9 +2161,20 @@ class TilesViewerContainerController extends BaseController {
2157
2161
  if (appTileGroup) {
2158
2162
  const lastTab = tabPanels.find((c) => c.label() === appTileGroup?.navigatorTitle);
2159
2163
  if (lastTab && selectedTabTitle !== lastTab.label()) {
2164
+ // تبِ ذخیره‌شده با تبِ auto-select‌شده فرق دارد → انتخابش کن؛ این خودش دوباره
2165
+ // onSelectedTabChange را (با firstSelected=false) صدا می‌زند و تایل‌هایش را لود می‌کند.
2160
2166
  appTileGroup = appGroups.find((c) => c.Id === lastSelectedAppGroupId);
2161
2167
  tabbarComponent.selectTab(lastTab.id());
2162
2168
  }
2169
+ else {
2170
+ // تبِ ذخیره‌شده همان تبِ اولِ auto-select‌شده است (مثلاً «مورد علاقه» که تبِ اول است).
2171
+ // در این حالت onSelectedTabChangeِ دومی نمی‌آید، پس همین‌جا تایل‌هایش را لود کن؛
2172
+ // در غیر این صورت روی reload، این تب با اسپینرِ گیرکرده و بدونِ تایل می‌ماند.
2173
+ this.setSelectedTab(appTileGroup);
2174
+ if (!this._tilesService.isAppTileGroupTilesLoaded(appTileGroup.Id)) {
2175
+ this.loadAppTileGroup(appTileGroup);
2176
+ }
2177
+ }
2163
2178
  return;
2164
2179
  }
2165
2180
  }
@@ -2485,7 +2500,12 @@ class TilesViewerComponent extends BaseComponent {
2485
2500
  }
2486
2501
  }
2487
2502
  onSelectedTabChange(selectedTab) {
2488
- if (!this.selectedTabTitle) {
2503
+ // _firstSelected باید در «اولین» فراخوانیِ خودکارِ تب (بعد از هر init/re-init) true بماند تا
2504
+ // منطقِ restore (انتخابِ تبِ ذخیره‌شده در localStorage توسطِ container) اجرا شود؛ فقط از
2505
+ // فراخوانیِ دوم به بعد — که selectedTabTitle قبلاً ست شده و یعنی تغییرِ واقعیِ کاربر — false شود.
2506
+ // پیش‌تر این شرط برعکس بود؛ وقتی صفحه‌ی launchpad دیگر route-reuse نمی‌شود و روی بستنِ فرم/گزارش
2507
+ // دوباره init می‌شود، تبِ انتخابیِ کاربر گم و به تبِ اول ریست می‌شد.
2508
+ if (this.selectedTabTitle) {
2489
2509
  this._firstSelected = false;
2490
2510
  }
2491
2511
  const selectedTabTitle = selectedTab.label || '';