Skip to content

Greatly improve the fetch/create/update Note handlers logic #26

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 15, 2024

Conversation

jhodapp
Copy link
Member

@jhodapp jhodapp commented Aug 14, 2024

Description

This PR greatly improves and fixes the fetch/create/update Note handlers logic on the coaching session page.

Note: this PR requires that you use the following backend branch

GitHub Issue: N/A

Changes

  • Move the createNote() method into the handlerInputChange() event handler alongside updateNote()
  • Ensure the fetch Note useEffect() logic works correctly in dev and prod modes since React calls the setup method twice in dev mode and once in prod mode
  • Handle an empty array of Notes returned by the backend (this is not a 404 error case)

Screenshots / Videos Showing UI Changes (if applicable)

N/A

Testing Strategy

  1. Open up the JS console in your browser to observe debug/error statements
  2. Login and select a coaching session to join
  3. Notice that no Note is displayed in the textarea by default
  4. Now type some text into the textarea and observe that you see a trace statement "Newly created Note: ..."
  5. Click the R Refactor logo in the upper right hand corner of the screen to return to the dashboard page
  6. Select and join the same coaching session, notice that the Note's contents show up in the textarea
  7. Make an update to the notes and navigate out of the session and back in like in step 5. Observe that the updated Note's contents show up in the textarea

Concerns

None

@jhodapp jhodapp added the enhancement Improves existing functionality or feature label Aug 14, 2024
@jhodapp jhodapp requested review from qafui and calebbourg August 14, 2024 18:30
@jhodapp jhodapp self-assigned this Aug 14, 2024
@jhodapp jhodapp merged commit 41f5f01 into main Aug 15, 2024
1 check passed
@jhodapp jhodapp deleted the fix_fetching_of_empty_notes branch August 15, 2024 04:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Improves existing functionality or feature
Projects
Status: ✅ Done
Development

Successfully merging this pull request may close these issues.

2 participants