fix: [sc-30750] bug with Otzar Midrashim #2181
Open
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.
Description
We noticed a bunch of infinite "Loading..." bugs on Otzar Midrashim. I discovered this bug exists on a few other indices as well -- because each of these indices has a depth 1 default node. The texts API for a ref returns next and previous section refs. The problem occurs when the next section is a default node. Most default nodes are depth 2, so when we return the next section ref, we return "{default node} 1", but when a default node is depth 2, we just return the name of the default node, which means we have no way of distinguishing it from its parent. The texts API then gets a request for the next section ref, which in this case comes before the current ref causing the client to get confused and to keep trying to hit the API.
Code Changes
When the texts API returns the next section ref, it calls next_section_ref, which simply needs special casing. In case we are dealing with a depth 1 default node, we convert the default node ref into a ranged segment ref so that it is not the identical string as the default node's parent.