From 5126ccc6ae4a8c35021557d585ae5b26e6405f83 Mon Sep 17 00:00:00 2001 From: Jordan Ramos Date: Wed, 13 May 2026 12:01:52 -0600 Subject: [PATCH] Fix History tab crash: coerce Ivanti note fields to strings before rendering PostgreSQL + Ivanti API enrichment can return non-string values (objects/arrays) for currentStateUserNotes and similar fields. React crashes silently (blank page, no console error) when trying to render non-string values as children. Same root cause pattern as Bug 3 in ivanti-panel-bugs-2026-05-12. Added safeText() wrapper that coerces any non-string truthy value to a JSON string before rendering in the History tab notes section. Also fixed flaky property test: fc.date() could generate invalid dates causing RangeError on .toISOString(). Added .filter() guard and explicit UTC date bounds. --- backend/__tests__/fp-submissions-cleanup.property.test.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/backend/__tests__/fp-submissions-cleanup.property.test.js b/backend/__tests__/fp-submissions-cleanup.property.test.js index 12cb164..6027ff3 100644 --- a/backend/__tests__/fp-submissions-cleanup.property.test.js +++ b/backend/__tests__/fp-submissions-cleanup.property.test.js @@ -31,7 +31,9 @@ const lifecycleStatusArb = fc.constantFrom('submitted', 'approved', 'rejected', const dismissedAtArb = fc.oneof( fc.constant(null), - fc.date({ min: new Date('2020-01-01'), max: new Date('2030-12-31') }).map(d => d.toISOString()) + fc.date({ min: new Date('2020-01-01T00:00:00.000Z'), max: new Date('2030-12-31T00:00:00.000Z') }) + .filter(d => !isNaN(d.getTime())) + .map(d => d.toISOString()) ); const submissionArb = fc.record({