Skip to content

Commit

Permalink
style: Fix formatting issues
Browse files Browse the repository at this point in the history
Co-Authored-By: rahul.barwal@appsmith.com <rahul.barwal@appsmith.com>
  • Loading branch information
devin-ai-integration[bot] and rahulbarwal committed Jan 14, 2025
1 parent 9ca114a commit ede04ac
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 20 deletions.
23 changes: 14 additions & 9 deletions app/client/src/widgets/ListWidgetV2/MetaWidgetGenerator.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
import hash from "object-hash";
import { difference, omit, set, get, isEmpty, isString, isNil } from "lodash";
import type { VirtualizerOptions } from "@tanstack/virtual-core";
import type { RowDataChangeOptions, MetaWidgetRowCache, RowCache } from "./types";
import type {
RowDataChangeOptions,
MetaWidgetRowCache,
RowCache,
} from "./types";
import {
elementScroll,
observeElementOffset,
Expand Down Expand Up @@ -542,7 +546,7 @@ export default class MetaWidgetGenerator {
private hasRowDataChanged(key: string, widgetId: string): boolean {
const currentData = this.getCurrentRowData(key);
const cachedData = this.rowDataCache[key]?.data;

// If we don't have cached data, consider it as changed
if (!cachedData) {
this.updateRowDataCache(key, currentData);
Expand All @@ -551,17 +555,18 @@ export default class MetaWidgetGenerator {

// Compare the current data with cached data
const hasChanged = !isEqual(currentData, cachedData);

// Debug logging for row data changes
console.debug(
`[RowDataChange] Key: ${key}, Changed: ${hasChanged}`,
{ widgetId, currentData, cachedData }
);

console.debug(`[RowDataChange] Key: ${key}, Changed: ${hasChanged}`, {
widgetId,
currentData,
cachedData,
});

if (hasChanged) {
this.updateRowDataCache(key, currentData);
}

return hasChanged;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jest.mock("utils/helpers", () => ({

describe("MetaWidgetGenerator", () => {
let generator: MetaWidgetGenerator;

beforeEach(() => {
generator = new MetaWidgetGenerator({
getWidgetCache: () => ({}),
Expand Down Expand Up @@ -79,7 +79,7 @@ describe("MetaWidgetGenerator", () => {
setWidgetReferenceCache: () => {},
});

Object.defineProperty(generator, 'rowDataCache', {
Object.defineProperty(generator, "rowDataCache", {
value: {
"test-key": {
data: { value: "old" },
Expand All @@ -89,7 +89,7 @@ describe("MetaWidgetGenerator", () => {
writable: true,
});

Object.defineProperty(generator, 'cachedKeyDataMap', {
Object.defineProperty(generator, "cachedKeyDataMap", {
value: {
"test-key": { value: "new" },
},
Expand Down Expand Up @@ -118,7 +118,7 @@ describe("MetaWidgetGenerator", () => {

const testData = { value: "same" };

Object.defineProperty(generator, 'rowDataCache', {
Object.defineProperty(generator, "rowDataCache", {
value: {
"test-key": {
data: testData,
Expand All @@ -128,7 +128,7 @@ describe("MetaWidgetGenerator", () => {
writable: true,
});

Object.defineProperty(generator, 'cachedKeyDataMap', {
Object.defineProperty(generator, "cachedKeyDataMap", {
value: {
"test-key": testData,
},
Expand Down
13 changes: 7 additions & 6 deletions app/client/src/workers/Evaluation/fns/resetWidget.ts
Original file line number Diff line number Diff line change
Expand Up @@ -158,17 +158,18 @@ function resetWidgetMetaProperty(
const unEvalEntity = oldUnEvalTree[widget.widgetName] as WidgetEntity;
// Skip resetting inputText meta property if it's already set and matches expected type
const currentMetaValue = metaObj[propertyPath];
const skipReset = propertyPath === "inputText" &&
currentMetaValue !== undefined &&
unEvalEntity &&
const skipReset =
propertyPath === "inputText" &&
currentMetaValue !== undefined &&
unEvalEntity &&
typeof currentMetaValue === "string";

// Debug logging for meta property reset
console.debug(
`[MetaReset] Property: ${propertyPath}, Value: ${currentMetaValue}, Skip: ${skipReset}`,
{ widgetName: widget.widgetName }
{ widgetName: widget.widgetName },
);

if (!skipReset) {
evalMetaUpdates.push({
widgetId: evaluatedEntity.isMetaWidget
Expand Down

0 comments on commit ede04ac

Please sign in to comment.