Skip to content

Commit

Permalink
fix data transformation in export
Browse files Browse the repository at this point in the history
  • Loading branch information
TMisiukiewicz committed Oct 2, 2024
1 parent 6bdc95f commit 3e305c3
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/libs/ExportOnyxState/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@ const maskSessionDetails = (data: Record<string, unknown>): Record<string, unkno
};
};

const maskFragileData = (data: Record<string, unknown>, parentKey?: string): Record<string, unknown> => {
const maskedData: Record<string, unknown> = {};

if (!data) {
return maskedData;
const maskFragileData = (data: Record<string, unknown> | unknown[], parentKey?: string): Record<string, unknown> | unknown[] => {
if (Array.isArray(data)) {
return data.map((item): unknown => (typeof item === 'object' ? maskFragileData(item as Record<string, unknown>, parentKey) : item));
}

const maskedData: Record<string, unknown> = {};

Object.keys(data).forEach((key) => {
if (!Object.prototype.hasOwnProperty.call(data, key)) {
return;
Expand Down Expand Up @@ -56,7 +56,7 @@ const maskOnyxState = (data: Record<string, unknown>, isMaskingFragileDataEnable
onyxState = maskSessionDetails(onyxState);
// Mask fragile data other than session details if the user has enabled the option
if (isMaskingFragileDataEnabled) {
onyxState = maskFragileData(onyxState);
onyxState = maskFragileData(onyxState) as Record<string, unknown>;
}

return onyxState;
Expand Down

0 comments on commit 3e305c3

Please sign in to comment.