react-file-viewer icon indicating copy to clipboard operation
react-file-viewer copied to clipboard

Missing keys on iterators

Open apennell opened this issue 6 years ago • 10 comments

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.

apennell avatar Jul 23 '18 21:07 apennell

Can confirm. That would fix it.

aarontropy avatar Aug 21 '18 00:08 aarontropy

@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

cmwint avatar Aug 29 '19 21:08 cmwint

Awesome @cmwint! Switched jobs and forgot about this issue 😁

apennell avatar Sep 05 '19 18:09 apennell

Still issue is there, if anyone there to maintain it please do it first, its a really good package.

SalmanHaider5 avatar Mar 18 '20 09:03 SalmanHaider5

Looks like the change never got deployed to npm

bsell93 avatar Apr 20 '20 13:04 bsell93

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

bsell93 avatar Apr 20 '20 13:04 bsell93

@michaelwolo can we get this change undone?

bsell93 avatar Apr 20 '20 13:04 bsell93

bumping this. Any chance this can happen?

mattburlage avatar Feb 17 '21 04:02 mattburlage

Made a pr to fix https://github.com/plangrid/react-file-viewer/pull/179

bsell93 avatar Feb 22 '21 14:02 bsell93

The issue still exists. till 2019. is this lib maintained?

HasinaNjaratin avatar Mar 03 '22 11:03 HasinaNjaratin