@quillsql/react 2.16.100 → 2.16.101

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.
package/dist/index.cjs CHANGED
@@ -62444,6 +62444,18 @@ var DASHBOARD_REPORT_RESULT_FIELDS = [
62444
62444
  "pivotColumns",
62445
62445
  "pivotRowCount"
62446
62446
  ];
62447
+ function pivotDimensionKey(pivot) {
62448
+ const value = pivot && typeof pivot === "object" ? pivot : {};
62449
+ return [
62450
+ String(value.rowField ?? "").trim(),
62451
+ String(value.rowFieldTable ?? "").trim(),
62452
+ String(value.columnField ?? "").trim(),
62453
+ String(value.columnFieldTable ?? "").trim()
62454
+ ].join("\0");
62455
+ }
62456
+ function pivotDimensionsChanged(previous, next) {
62457
+ return pivotDimensionKey(previous?.pivot) !== pivotDimensionKey(next.pivot);
62458
+ }
62447
62459
  function dashboardReportQueryKey(reportId) {
62448
62460
  return ["quill", "dashboard-report", reportId];
62449
62461
  }
@@ -62455,8 +62467,15 @@ function mergeSavedReportIntoDashboardQueryData(previous, saved) {
62455
62467
  ...saved,
62456
62468
  ...savedId ? { id: savedId } : {}
62457
62469
  };
62470
+ const dimensionsChanged = pivotDimensionsChanged(previousReport, merged);
62458
62471
  for (const field of DASHBOARD_REPORT_RESULT_FIELDS) {
62459
- if (merged[field] == null && previousReport?.[field] != null) {
62472
+ const savedValue = saved[field];
62473
+ if (savedValue != null) continue;
62474
+ if (dimensionsChanged) {
62475
+ delete merged[field];
62476
+ continue;
62477
+ }
62478
+ if (previousReport?.[field] != null) {
62460
62479
  merged[field] = previousReport[field];
62461
62480
  }
62462
62481
  }
@@ -71512,7 +71531,12 @@ function useReport(reportIdArg, options = {}) {
71512
71531
  yAxisFields: yAxisMeasures,
71513
71532
  pivot: effectiveReportBuilderState.pivot ?? null,
71514
71533
  reportBuilderState: effectiveReportBuilderState,
71515
- columns: columnsSelectedForSave
71534
+ columns: columnsSelectedForSave,
71535
+ rows: sourceReport.rows,
71536
+ compareRows: sourceReport.compareRows,
71537
+ pivotRows: sourceReport.pivotRows,
71538
+ pivotColumns: sourceReport.pivotColumns,
71539
+ pivotRowCount: sourceReport.pivotRowCount
71516
71540
  };
71517
71541
  syncDashboardReportQueryCacheAfterSave(
71518
71542
  queryClient,
package/dist/index.js CHANGED
@@ -62652,6 +62652,18 @@ var DASHBOARD_REPORT_RESULT_FIELDS = [
62652
62652
  "pivotColumns",
62653
62653
  "pivotRowCount"
62654
62654
  ];
62655
+ function pivotDimensionKey(pivot) {
62656
+ const value = pivot && typeof pivot === "object" ? pivot : {};
62657
+ return [
62658
+ String(value.rowField ?? "").trim(),
62659
+ String(value.rowFieldTable ?? "").trim(),
62660
+ String(value.columnField ?? "").trim(),
62661
+ String(value.columnFieldTable ?? "").trim()
62662
+ ].join("\0");
62663
+ }
62664
+ function pivotDimensionsChanged(previous, next) {
62665
+ return pivotDimensionKey(previous?.pivot) !== pivotDimensionKey(next.pivot);
62666
+ }
62655
62667
  function dashboardReportQueryKey(reportId) {
62656
62668
  return ["quill", "dashboard-report", reportId];
62657
62669
  }
@@ -62663,8 +62675,15 @@ function mergeSavedReportIntoDashboardQueryData(previous, saved) {
62663
62675
  ...saved,
62664
62676
  ...savedId ? { id: savedId } : {}
62665
62677
  };
62678
+ const dimensionsChanged = pivotDimensionsChanged(previousReport, merged);
62666
62679
  for (const field of DASHBOARD_REPORT_RESULT_FIELDS) {
62667
- if (merged[field] == null && previousReport?.[field] != null) {
62680
+ const savedValue = saved[field];
62681
+ if (savedValue != null) continue;
62682
+ if (dimensionsChanged) {
62683
+ delete merged[field];
62684
+ continue;
62685
+ }
62686
+ if (previousReport?.[field] != null) {
62668
62687
  merged[field] = previousReport[field];
62669
62688
  }
62670
62689
  }
@@ -71720,7 +71739,12 @@ function useReport(reportIdArg, options = {}) {
71720
71739
  yAxisFields: yAxisMeasures,
71721
71740
  pivot: effectiveReportBuilderState.pivot ?? null,
71722
71741
  reportBuilderState: effectiveReportBuilderState,
71723
- columns: columnsSelectedForSave
71742
+ columns: columnsSelectedForSave,
71743
+ rows: sourceReport.rows,
71744
+ compareRows: sourceReport.compareRows,
71745
+ pivotRows: sourceReport.pivotRows,
71746
+ pivotColumns: sourceReport.pivotColumns,
71747
+ pivotRowCount: sourceReport.pivotRowCount
71724
71748
  };
71725
71749
  syncDashboardReportQueryCacheAfterSave(
71726
71750
  queryClient,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quillsql/react",
3
- "version": "2.16.100",
3
+ "version": "2.16.101",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": {