From 03c32218367911234ae8a11c4ef6cdcf5a089ebb Mon Sep 17 00:00:00 2001 From: Imran Farhat Date: Wed, 17 Jun 2026 17:07:05 +0530 Subject: [PATCH] fix: restore scored and score fields when resetting LTI state after delete After deleting an LTI app, creating a new one for the same circuit failed with a 400 error, with no feedback shown to the user beyond a generic console error. Root cause: handleDeleteLTIApp rebuilds the component's ltiDetails state from scratch after a successful delete, but the rebuilt object didn't match the shape of a genuinely fresh, working state in two ways: - It omitted the scored field entirely. Once scored became undefined, it stayed undefined unless the user manually toggled the checkbox, and got silently dropped from the request body (the backend requires this field). - It set score to an empty string. The backend's score field allows null but rejects an empty string as 'not a valid number', and the empty string only avoided this on a fresh page load by coincidence (an unrelated code path there replaces the whole state object without a score key at all, rather than setting it to an empty string). Fix: - Added scored: true to match the component's actual initial state - Changed score from '' to null, matching what the backend's score field explicitly allows Testing: - Created an LTI app, deleted it, created a new one for the same circuit without touching the Score or Scored fields: succeeds (201) where it previously failed (400) --- eda-frontend/src/components/LTI/LTI.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/eda-frontend/src/components/LTI/LTI.js b/eda-frontend/src/components/LTI/LTI.js index 5f8f585e..776479f9 100644 --- a/eda-frontend/src/components/LTI/LTI.js +++ b/eda-frontend/src/components/LTI/LTI.js @@ -251,10 +251,11 @@ export default function LTIConfig () { configURL: '', configExists: false, consumerError: '', - score: '', + score: null, initialSchematic: '', modelSchematic: modelSchematic, testCase: null, + scored: true, id: '' }) setHistoryId('') @@ -386,7 +387,7 @@ export default function LTIConfig () { {ltiDetails.consumerError &&

{ltiDetails.consumerError}

} - + Schematic