It should fail display the failing message :
https://codesandbox.io/s/libdetailslist-l79rv
After upgrading to version 7, we noticed that our jest
(that uses babel) tests were failing when trying to access any component from office-ui-fabric-react/lib/DetailsList
by giving the message :
TypeError: Cannot redefine property: SelectionMode
at Function.defineProperty (<anonymous>)
[...]
at node_modules/office-ui-fabric-react/lib/utilities/src/utilities/selection/index.ts:3:1
at Array.forEach (<anonymous>)
at Object.<anonymous> (node_modules/office-ui-fabric-react/lib/utilities/src/utilities/selection/index.ts:3:1)
at Object.<anonymous> (node_modules/office-ui-fabric-react/lib/components/src/components/DetailsList/index.ts:1:1)
at Object.<anonymous> (node_modules/office-ui-fabric-react/src/DetailsList.ts:1:1)
[...]
We can't directly reference from office-ui-fabric-react
.
While creating the code sandbox for this issue, I noticed that the problem occurred directly so it might not be due to our jest configuration.
It's the only component that had this problem.
Should we still be able to access DetailsList
through office-ui-fabric-react/lib/DetailsList
?
Requested priority: Low
Thank you
Hi @rhublard, thanks for reporting this issue! I think this is happening because there are multiple places in office-ui-fabric-react
that are re-exporting utilities/selection/index
. I've tried this and have gotten the same error importing from:
office-ui-fabric-react/lib/DetailsList
office-ui-fabric-react/lib/MarqueeSelection
office-ui-fabric-react/lib/Selection
I think, in order to stop having this error, we should remove the utilities/selection/index
exports from both DetailsList
and MarqueeSelection
.
@kenotron I'd like your input here. Does this seem correct to you?
Hi there.
Is there any updates on that? Maybe there is workaround for this issue? I have tried to export
import { ShimmeredDetailsList } from 'office-ui-fabric-react/lib/components/DetailsList/ShimmeredDetailsList';
directly but it seems that issue is still there
Is there a version we can expect this fix (#9750) in?
Hi @rhublard, thanks for reporting this issue! I think this is happening because there are multiple places in
office-ui-fabric-react
that are re-exportingutilities/selection/index
. I've tried this and have gotten the same error importing from:
office-ui-fabric-react/lib/DetailsList
office-ui-fabric-react/lib/MarqueeSelection
office-ui-fabric-react/lib/Selection
I think, in order to stop having this error, we should remove the
utilities/selection/index
exports from bothDetailsList
andMarqueeSelection
.@kenotron Ken Chau FTE I'd like your input here. Does this seem correct to you?
We might have had to reexport because of declaration: true. So it might have been that. Not sure the next steps - will discuss offline with @jdhuntington on this.
@rhublard Sorry you're running into this! Afraid I'm having some difficulty verifying a fix, as getting a local repro is proving non-trivial. Somehow the codesandbox link seems to work fine when cloning and running locally.
Is it possible to clone the repo that is encountering this build issue? If not, are you willing to share a few more details such as...
thank you!
I have recreated the codesandbox code here: https://github.com/kenotron/oufr-repro and it doesn't repro for me. Not sure what codesandbox is doing to our code here. @rhublard, can you create a repo that has this repro that isn't codesandbox (as they might be doing something odd with their bundling)
@sushruth: @jdhuntington has prepared a PR that reverts one of the most recent instances of an additional export of SelectionMode
. This PR has just been merged. The bot will notify in about 6 hours time when there is a version of OUFR you can consume the fix in.
version 7.19.1
contains the fix, and the codesandbox you provided appears to work correctly when targeting that version.
@rhublard @yury-stepanov @sushruth Please let us know if this fixes the issues you've been having.
Hi, it solved our issue, we were able to run jest.
Thank you for the fix!
Most helpful comment
I have recreated the codesandbox code here: https://github.com/kenotron/oufr-repro and it doesn't repro for me. Not sure what codesandbox is doing to our code here. @rhublard, can you create a repo that has this repro that isn't codesandbox (as they might be doing something odd with their bundling)