You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
🔴 Critical: store.edit crashes when the id doesn't exist.
constnote=data.notes.find((n)=>n.id===id);note.text=text;// note is undefined when no id matches → TypeError
find returns undefined for a missing id, so note.text = text throws TypeError: Cannot set properties of undefined. Reproduced: node notes.js edit 99 "x" crashes with a stack trace (exit 1). remove already guards this case and returns a boolean — edit should too.
🟠 The CLI always reports success.notes.js prints Updated note #${id} unconditionally because edit returns nothing, so editing a missing id would falsely claim success even after the crash is fixed.
🟡 Minor: no validation. A non-numeric id is NaN (never matches → same crash path); an empty text silently blanks the note.
Suggested fix: make edit return whether it found the note and branch the message, mirroring delete:
Verdict: Claude caught the planted bug — store.edit crashes with a TypeError when the note id doesn't exist (unguarded find). Confirmed by reproducing the crash.
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
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.
Adds an
editcommand so notes can be updated in place:node notes.js edit <id> <text>.store.edit(id, text)helper inlib/store.js.editcase innotes.js, and the command is listed in the default help line.Opened for review as part of Unit 4 Lesson 4.