LukeMurphey / textcritical_spa

A React-based SPA (single page application that serves as the frontend for TextCritical.net)
Apache License 2.0
1 stars 0 forks source link

Selected verse doesn’t work when typed in the nav bar #35

Open LukeMurphey opened 2 years ago

LukeMurphey commented 2 years ago

It appears to remember the prior verse but doesn't update based on the updated verse number.

LukeMurphey commented 2 years ago

The verse to highlight gets set correctly, but then set to null in loadChapter(). The fetch sets it again to null because it isn't returning a verse_to_highlight.

LukeMurphey commented 2 years ago

Questions:

Is the correct URL being called with the verse to highlight set?

Why is the resolved reference not being used?

What is the lifecycle of the reference to loading the page for a typed reference?

  1. ReadingMenuBar: accepts key presses and checks the server to see if the reference is valid
  2. ReadingMenuBar: if the user presses "enter", the reference is checked in checkAndGoToReference() and Reader::goToReference() is called to go to the new page
  3. Reader::goToReference() accepts the request to go to a new reference and calls navigateToChapter() which calls updateHistory() to modify the URL and load the new path

Should the URL include the verse?

Can I fix this by having reference checking use the full URL?

What are the cases I need to test?

  1. Unit tests
  2. Navigate to a verse in another chapter via the input box
  3. Navigate to a verse in the same chapter via the input box
  4. Navigate to a verse in a book via the URL
  5. Cases 2-4 with multiple works open

Observations:

    if(referenceInfo.verse_to_highlight) {
      updateHistory(requestedWork, secondWork, ...referenceInfo.divisions, referenceInfo.verse_to_highlight);
    }
    else {
      updateHistory(requestedWork, secondWork, ...referenceInfo.divisions);
    }
LukeMurphey commented 2 years ago

Here is the problem:

goToReference() calls updateHistory() but provides no way for the selected verse to be persisted.