@shival99/z-ui 1.2.30 → 1.2.31

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.
@@ -20,7 +20,6 @@ import { ZSafeHtmlPipe } from '@shival99/z-ui/pipes';
20
20
  import { ZTranslateService, ZCacheService } from '@shival99/z-ui/services';
21
21
  import { createAngularTable, getFacetedMinMaxValues, getFacetedUniqueValues, getFacetedRowModel, getPaginationRowModel, getSortedRowModel, getFilteredRowModel, getExpandedRowModel, getCoreRowModel, FlexRenderDirective } from '@tanstack/angular-table';
22
22
  import { NgScrollbar } from 'ngx-scrollbar';
23
- import { effectOnceIf } from 'ngxtension/effect-once-if';
24
23
  import { explicitEffect } from 'ngxtension/explicit-effect';
25
24
  import { injectDestroy } from 'ngxtension/inject-destroy';
26
25
  import { ZDropdownMenuComponent } from '@shival99/z-ui/components/z-dropdown-menu';
@@ -3057,15 +3056,45 @@ class ZTableComponent {
3057
3056
  explicitEffect([this._zTranslate.currentLang], () => {
3058
3057
  this._dataForceUpdate.update(v => v + 1);
3059
3058
  });
3060
- effectOnceIf(computed(() => {
3061
- const key = this.zKey();
3062
- const config = this.zConfig();
3063
- return !!key && !!config.columns && config.columns.length > 0 && !this._configCacheLoaded;
3064
- }), () => {
3065
- this._loadConfigCache();
3066
- this._configCacheLoaded = true;
3059
+ explicitEffect([this.zKey, this.zConfig], ([key, config]) => {
3060
+ // Only load config cache once when key and valid columns are available
3061
+ if (key && config.columns && config.columns.length > 0 && !this._configCacheLoaded) {
3062
+ this._loadConfigCache();
3063
+ this._configCacheLoaded = true;
3064
+ }
3067
3065
  });
3068
3066
  explicitEffect([this.zConfig], ([cfg]) => {
3067
+ // Skip applying initialState for properties that were loaded from cache
3068
+ // Cache values have priority over initialState
3069
+ if (this._configCacheLoaded) {
3070
+ // Only apply non-column-layout related initial state when cache is loaded
3071
+ const initial = cfg.initialState;
3072
+ if (initial) {
3073
+ // These are not stored in cache, so always apply them
3074
+ if (initial.sorting) {
3075
+ this.sorting.set(initial.sorting);
3076
+ }
3077
+ if (initial.columnFilters) {
3078
+ this.columnFilters.set(initial.columnFilters);
3079
+ }
3080
+ if (initial.globalFilter) {
3081
+ this.globalFilter.set(initial.globalFilter);
3082
+ }
3083
+ if (initial.expanded) {
3084
+ this.expanded.set(initial.expanded);
3085
+ }
3086
+ if (initial.rowSelection) {
3087
+ this.rowSelection.set(initial.rowSelection);
3088
+ }
3089
+ if (initial.rowPinning) {
3090
+ this.rowPinning.set(initial.rowPinning);
3091
+ }
3092
+ if (initial.pagination) {
3093
+ this.pagination.set(initial.pagination);
3094
+ }
3095
+ }
3096
+ return;
3097
+ }
3069
3098
  const initial = cfg.initialState;
3070
3099
  if (initial) {
3071
3100
  if (initial.columnPinning) {