futurepress / epub.js

Enhanced eBooks in the browser.
http://futurepress.org
Other
6.41k stars 1.1k forks source link

Sections returned from book.spine.get contain incorrect html in React #1282

Open jmcelfresh opened 2 years ago

jmcelfresh commented 2 years ago

I'm trying to get a version of the renderless example working in my React app.

const section = book.spine.get(href)

section.render().then(html => {
    console.log('rendered html', html)
})

When I run this code the rendered html returned is the contents of the index.html document used by my React app, not the chapter requested. It returns this same html no matter which spine item I request. The other section values are correct, representing information about the section at the requested href, with the notable exception of section.output which also contains index.html values, not the chapter html.

If I used book.renderTo to create a rendition then call redition.display(href) I get the correct html in an iframe as expected.

johnfactotum commented 3 weeks ago

See https://github.com/futurepress/epub.js/issues/1397#issuecomment-2323135341