also, there probably is a problem in that you need to have the titles of sections in the index event? as the third or usually "relay" field of the tag? otherwise you'd end up having to load and parse all the sections which i guess you already sorted this out but just made me think of it because a ToC on a segmented document has to have some reasonable text to load without touching the segments
Discussion
The section headers get removed from the content and placed in the section events' "title" tag, with discrete headers untouched.
We lazy-load the sections, as you scroll down and as you open up levels in the ToC. We therefore have to handle someone opening up a level in the ToC, that hasn't been loaded into the reading panel, already, like a fast-forward viewer, but just of that section. The sections inbetween get filled in, as they scroll toward the already-renderd sections.
Or something like that. I think. 😂🤷🏻♀️
When you try it out, it is really underwhelming. Click ToC text, jump to section in publication.
That the publication can have 30k sections and you've only loaded the first 200, but you can still jump to sections 8018-8020, and render them on the fly, is completely invisible to the user.
But that's the Biblical use case and we promised that would work, so we're making it work.