Skip to content

Commit 046af66

Browse files
ShivaReddyVanjashivareddyvanja
authored andcommitted
fix(webapp): prevent date string reformatting in log details
This prevents the logger from reformatting date-like strings (e.g., "Tuesday...") into ISO format. We now prioritize rawAttributes from the backend to bypass superjson's automatic date transformation, ensuring the UI displays exactly what was logged.
1 parent 4d36d20 commit 046af66

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

apps/webapp/app/components/logs/LogDetailView.tsx

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,12 +207,25 @@ export function LogDetailView({ logId, initialLog, onClose, searchTerm }: LogDet
207207
function DetailsTab({ log, runPath, searchTerm }: { log: LogEntry; runPath: string; searchTerm?: string }) {
208208
const logWithExtras = log as LogEntry & {
209209
attributes?: LogAttributes;
210+
rawAttributes?: string;
210211
};
211212

212213

213214
let beautifiedAttributes: string | null = null;
214215

215-
if (logWithExtras.attributes) {
216+
if (logWithExtras.rawAttributes) {
217+
try {
218+
// It's a string, so we need to parse it first to be able to re-stringify it with indentation
219+
const parsed = JSON.parse(logWithExtras.rawAttributes);
220+
beautifiedAttributes = JSON.stringify(parsed, null, 2);
221+
} catch (e) {
222+
beautifiedAttributes = logWithExtras.rawAttributes;
223+
}
224+
// We already have the raw string, so we don't need to format it again
225+
if (beautifiedAttributes) {
226+
beautifiedAttributes = formatStringJSON(beautifiedAttributes);
227+
}
228+
} else if (logWithExtras.attributes) {
216229
beautifiedAttributes = JSON.stringify(logWithExtras.attributes, null, 2);
217230
beautifiedAttributes = formatStringJSON(beautifiedAttributes);
218231
}

0 commit comments

Comments
 (0)