React-pdf: Re-Render Error JS appendChildBefore after modify state

Created on 31 May 2019  路  3Comments  路  Source: diegomura/react-pdf

Hello diegomura,

I have a problem with the @react-pdf/renderer functions :
image

When i try to reload the PDFViewer Document when state update, the reac-pdf function try to do a "appendChildBefore" but it isn't a function in Javascript ?

My Component :
image
image

I have an array of pages, when i click on a checkBox (handleCheckPage) i can hide or show a page in the pdf. When the action of loadPages was call (modify status show on my pages) the state was updated and render the component, i have the error.
At start the PDF loading correctly but when i try update state, it's fail.

You should probably don't use a "appendChildBefore" function that doesn't exist in JS ?

Thank you for answering,
Bye

All 3 comments

Try adding a key when you map through the pages array.

Please try what @nero2009 suggested.

It's hard, not to say impossible, to know what's going on by your image (also, it's much better to share the code for people can just copy).

If this persist, please provide a simple example I can use to replicate

Hello,

Thank you for your answers.

I try to add a key but the problem persist.

Link to a simple code example : https://codesandbox.io/s/charming-maxwell-j6oym

You need to open the result in a new window.

When you try to check the "Show page 1" you have this error
image

Thank's for answering

Was this page helpful?
0 / 5 - 0 ratings

Related issues

serkyen picture serkyen  路  4Comments

kishaningithub picture kishaningithub  路  4Comments

benbenedek picture benbenedek  路  3Comments

emt1803 picture emt1803  路  3Comments

diegomura picture diegomura  路  4Comments