Alcumus / react-doc-viewer

Apache License 2.0
208 stars 101 forks source link

Content disappeared when render. #104

Open shahariar50 opened 2 years ago

shahariar50 commented 2 years ago

I am working on a react project where I have been trying to preview the different types of files from the different link and when the link changes, the app renders and the preview disappears.

anbu-securra commented 2 years ago

Facing the same issue. Please update if you got any leads.

anbu-securra commented 2 years ago

image

File: https://github.com/Alcumus/react-doc-viewer/blob/master/src/components/ProxyRenderer.tsx

CurrentRenderer variable is undefined and because of that null value is being returned and it turns out to be replacing the old content with null value ie. the preview disappears.

blackhill commented 2 years ago

@shahariar50 @anbu-securra Did you find a workaround? Thanks

shahariar50 commented 2 years ago

@blackhill Not yet

blackhill commented 2 years ago

@shahariar50 I used a Memo to rerender the component only if the docs are changed. This worked for me.