Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -85,12 +85,12 @@ const successSchema = {
original: {
title: 'Original',
description: 'Original value before the state change',
type: ['string', 'object', 'null'],
type: ['string', 'number', 'boolean', 'object', 'array', 'null'],
},
dirty: {
title: 'Dirty',
description: 'New value after the state change',
type: ['string', 'object', 'null'],
type: ['string', 'number', 'boolean', 'object', 'array', 'null'],
},
raw: {
title: 'Raw Elements',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -578,8 +578,8 @@ interface LogRaw {
export interface StateDiff {
address: string;
soltype: SoltypeElement | null;
original: string | Record<string, any> | null;
dirty: string | Record<string, any> | null;
original: string | number | boolean | Record<string, any> | unknown[] | null;
dirty: string | number | boolean | Record<string, any> | unknown[] | null;
Comment thread
coderabbitai[bot] marked this conversation as resolved.
raw?: RawElement[];
}

Expand Down
9 changes: 5 additions & 4 deletions libs/repositories/src/utils/buildStateDiff.ts
Original file line number Diff line number Diff line change
Expand Up @@ -134,9 +134,9 @@ function processRawOnlyDiff(
if (!updated) {
const newDiff: StateDiff = {
address: diff.address,
soltype: diff.soltype || null,
original: diff.original || null,
dirty: diff.dirty || null,
soltype: diff.soltype ?? null,
original: diff.original ?? null,
dirty: diff.dirty ?? null,
raw: [structuredClone<typeof rawElement>(rawElement)],
};

Expand All @@ -153,7 +153,8 @@ function processSingleDiff(
diff: StateDiff
): StateDiff[] {
// Handle regular diffs (with complete soltype, original, dirty data)
if (diff?.soltype && diff?.original && diff?.dirty) {
// Using != null (loose check) intentionally to catch both null and undefined
if (diff?.soltype != null && diff?.original != null && diff?.dirty != null) {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nitpick: is it intentional to do a loose check instead of strict? (!= vs !==)

Copy link
Copy Markdown
Contributor Author

@limitofzero limitofzero Apr 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, it checks null and undefined at the same moment, I will add comment

return processRegularDiff(accumulatedStateDiff, diff);
}
// Handle raw-only diffs (missing soltype, original, or dirty)
Expand Down
Loading