fluentui icon indicating copy to clipboard operation
fluentui copied to clipboard

Wrapping in <Fabric> component causes typeerror

Open jansomers opened this issue 8 years ago • 5 comments

Bug Report

  • Package version(s): 5.39.1 (typescript 2.6.2)
  • Browser and OS versions: Chrome

Priorities and help requested (not applicable if asking question):

Requested priority: Cannot add fabric to my project

Describe the issue:

When installing office-ui-fabric-react and adding it to the project , by wrapping around my component, the browser is giving me a type error.

Actual behavior:

Project compiles fine but after loading in the browser I get the error. Without office-ui-fabric everything works fine

Expected behavior:

To have my project working with office-ui-fabric

If applicable, please provide a codepen repro:

import * as React from 'react';
import * as ReactDOM from 'react-dom';
import { Fabric } from 'office-ui-fabric-react/lib/Fabric';

const Page = () => (
    <Fabric>
        <p> Hello </p>
    </Fabric>
);

ReactDOM.render(
        <Page />
    , document.getElementById('root'));


The error:

BaseComponent.js:208 Uncaught TypeError: Cannot assign to read only property 'render' of object '#' at _makeSafe (BaseComponent.js:208) at _makeAllSafe (BaseComponent.js:198) at ProxyComponent.BaseComponent [as constructor] (BaseComponent.js:25) at new Fabric (Fabric.js:28) at new Fabric (eval at ./node_modules/react-stand-in/lib/utils.js (utils.js:64), :5:7) at constructClassInstance (react-dom.development.js:6355) at updateClassComponent (react-dom.development.js:7839) at beginWork (react-dom.development.js:8225) at performUnitOfWork (react-dom.development.js:10224) at workLoop (react-dom.development.js:10288) _makeSafe @ BaseComponent.js:208 _makeAllSafe @ BaseComponent.js:198 BaseComponent @ BaseComponent.js:25 Fabric @ Fabric.js:28 Fabric @ VM1061:5 constructClassInstance @ react-dom.development.js:6355 updateClassComponent @ react-dom.development.js:7839 beginWork @ react-dom.development.js:8225 performUnitOfWork @ react-dom.development.js:10224 workLoop @ react-dom.development.js:10288 callCallback @ react-dom.development.js:542 invokeGuardedCallbackDev @ react-dom.development.js:581 invokeGuardedCallback @ react-dom.development.js:438 renderRoot @ react-dom.development.js:10366 performWorkOnRoot @ react-dom.development.js:11014 performWork @ react-dom.development.js:10967 requestWork @ react-dom.development.js:10878 scheduleWorkImpl @ react-dom.development.js:10732 scheduleWork @ react-dom.development.js:10689 scheduleTopLevelUpdate @ react-dom.development.js:11193 updateContainer @ react-dom.development.js:11231 (anonymous) @ react-dom.development.js:15226 unbatchedUpdates @ react-dom.development.js:11102 renderSubtreeIntoContainer @ react-dom.development.js:15225 render @ react-dom.development.js:15290 (anonymous) @ index.tsx:16 ./src/index.tsx @ index.tsx:18 webpack_require @ bootstrap 62e82528306927ac6050:712 fn @ bootstrap 62e82528306927ac6050:117 0 @ index.tsx:18 webpack_require @ bootstrap 62e82528306927ac6050:712 webpackJsonpCallback @ bootstrap 62e82528306927ac6050:25 (anonymous) @ app.js:1 react-dom.development.js:9747 The above error occurred in the component: in Fabric (created by CustomizedFabric) in CustomizedFabric (created by Page) in Page

jansomers avatar Jan 16 '18 08:01 jansomers

It is caused by a conflict with the react-hot-loader babel plugin

jansomers avatar Jan 16 '18 08:01 jansomers

Is this error specific to the <Fabric> component? Can you try adding just a button to see if the same error is triggered?

gokunymbus avatar Jan 18 '18 19:01 gokunymbus

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions to Fabric React!

stale[bot] avatar Apr 11 '18 02:04 stale[bot]

@jansomers can you confirm if you're still seeing this with the latest packages (Fabric React 5.87.0 and TypeScript 2.8 as of this writing)?

Jahnp avatar Apr 23 '18 18:04 Jahnp

If you are still seeing the same issue after installing the current version, please open a new issue. Closing due to inactivity.

michaelangotti avatar May 03 '18 18:05 michaelangotti