Fix: recreating an LTI app after deletion fails with a 400 error#29
Open
ImranFarhat01 wants to merge 1 commit into
Open
Fix: recreating an LTI app after deletion fails with a 400 error#29ImranFarhat01 wants to merge 1 commit into
ImranFarhat01 wants to merge 1 commit into
Conversation
…elete 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)
d8d46d5 to
03c3221
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
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
The component rebuilds its 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:
silently dropped from the request body
rejects as "not a valid number" (it allows null, but not an
empty string)
Fix
actual initial default
what the backend explicitly allows
Testing
circuit without touching any optional fields: succeeds where it
previously failed