react-file-viewer
react-file-viewer copied to clipboard
Missing keys on iterators
Version: ^0.4.2
Steps to Reproduce
View a PDF with multiple pages Look at JS console in browser
Expected Behavior
Keys on all iterators so that there are no warnings
Actual Behavior
Warning in console:
warning.js?6327:33 Warning: Each child in an array or iterator should have a unique "key" prop. Check the render method of `t`. See https://fb.me/react-warning-keys for more information.
in t (created by t)
in t (created by t)
in div (created by t)
in div (created by t)
in t (created by EvidencePreviewModal)
I tracked this line 117 in pdf-viewer.jsx, although it may be happening in other file type components as well. A key needs to be added here within <PDFPage />
: key={`page-${index}`}
. I don't have time at the moment to do it, but if you're open to PR's I may be able to get to it.
Can confirm. That would fix it.
@apennell @aaronnorby I am also experiencing this issue. I went ahead and created a PR to fix this: https://github.com/plangrid/react-file-viewer/pull/107
Awesome @cmwint! Switched jobs and forgot about this issue 😁
Still issue is there, if anyone there to maintain it please do it first, its a really good package.
Looks like the change never got deployed to npm
Just kidding it looks like the change got removed in this commit https://github.com/plangrid/react-file-viewer/commit/78f15818295f0c55c549614083ce655cd2a67079#diff-227f34f5a8fb440046daea8d13f0c149
Current code in master: https://github.com/plangrid/react-file-viewer/blob/e474c12572d5d0960b8607c631d102a9348a4dd3/src/components/drivers/pdf-viewer.jsx#L129-L135
@michaelwolo can we get this change undone?
bumping this. Any chance this can happen?
Made a pr to fix https://github.com/plangrid/react-file-viewer/pull/179
The issue still exists. till 2019. is this lib maintained?