@shival99/z-ui 1.2.27 → 1.2.28

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.
@@ -2350,6 +2350,7 @@ class ZTableComponent {
2350
2350
  _dataForceUpdate = signal(0, ...(ngDevMode ? [{ debugName: "_dataForceUpdate" }] : []));
2351
2351
  _columnConfigCache = new Map();
2352
2352
  _lastColumnsRef = null;
2353
+ _initialStateApplied = false;
2353
2354
  pinnedColumnIds = computed(() => {
2354
2355
  this._columnPinVersion();
2355
2356
  return this.columnOrder().filter(id => {
@@ -3062,7 +3063,14 @@ class ZTableComponent {
3062
3063
  effect(() => {
3063
3064
  const cfg = this.zConfig();
3064
3065
  const initial = cfg.initialState;
3066
+ const cols = cfg.columns ?? [];
3065
3067
  untracked(() => {
3068
+ // Only apply initial state once on first run
3069
+ // This prevents overwriting cached settings when zConfig changes (e.g., data loads)
3070
+ if (this._initialStateApplied) {
3071
+ return;
3072
+ }
3073
+ this._initialStateApplied = true;
3066
3074
  if (initial) {
3067
3075
  if (initial.columnPinning) {
3068
3076
  this.columnPinning.set(initial.columnPinning);
@@ -3093,7 +3101,6 @@ class ZTableComponent {
3093
3101
  }
3094
3102
  }
3095
3103
  this.showHeaderFooterShadow.set(cfg.showHeaderShadow ?? cfg.showFooterShadow ?? true);
3096
- const cols = cfg.columns ?? [];
3097
3104
  const leftPinned = [...(initial?.columnPinning?.left ?? [])];
3098
3105
  const rightPinned = [...(initial?.columnPinning?.right ?? [])];
3099
3106
  const collectPinnedColumns = (columns) => {
@@ -3654,12 +3661,11 @@ class ZTableComponent {
3654
3661
  }
3655
3662
  try {
3656
3663
  const config = ZCacheService.get(`table-config-${key}`);
3657
- console.log('🚀 ~ config:', config);
3658
3664
  if (!config) {
3659
3665
  return;
3660
3666
  }
3661
3667
  if (!this._isColumnConfigValid(config.columnInfo)) {
3662
- console.warn('Saved table config is invalid due to column changes. Ignoring saved config.');
3668
+ console.warn('Saved table config is invalid or outdated. Ignoring saved config.');
3663
3669
  ZCacheService.delete(`table-config-${key}`);
3664
3670
  return;
3665
3671
  }