Skip to content

Commit

Permalink
Update: Import regnerator runtime as part of React components (#161)
Browse files Browse the repository at this point in the history
And remove it from the wrapper, so that developers are not forced
to import it themselves other than adding peer dep.
  • Loading branch information
priyajeet authored Jan 16, 2018
1 parent 985d6b6 commit f6ef28d
Show file tree
Hide file tree
Showing 8 changed files with 9 additions and 8 deletions.
6 changes: 1 addition & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,7 @@ The instructions below describe how to use the UI Elements in a [React](https://
## Installation
`yarn add box-ui-elements` or `npm install box-ui-elements`

To prevent duplication, the UI Elements require certain peer dependencies to be installed manually. For a list of required peer dependencies, see [package.json](package.json).

This project also requires [regenerator-runtime](https://www.npmjs.com/package/regenerator-runtime), since our source code uses async/await. This can be achieved by installing the dependency (also listed as part of the peer dependencies) and then adding the following line in your parent React project:

`import 'regenerator-runtime/runtime';`
To prevent library duplication, the UI Elements require certain peer dependencies to be installed manually. For a list of required peer dependencies, see [package.json](package.json).

## Browser Support
* Desktop Chrome, Firefox, Safari, Edge (latest 2 versions)
Expand Down
1 change: 1 addition & 0 deletions src/components/ContentExplorer/ContentExplorer.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
* @author Box
*/

import 'regenerator-runtime/runtime';
import React, { Component } from 'react';
import classNames from 'classnames';
import debounce from 'lodash/debounce';
Expand Down
1 change: 1 addition & 0 deletions src/components/ContentPicker/ContentPicker.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
* @author Box
*/

import 'regenerator-runtime/runtime';
import React, { Component } from 'react';
import classNames from 'classnames';
import debounce from 'lodash/debounce';
Expand Down
1 change: 1 addition & 0 deletions src/components/ContentPreview/ContentPreview.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
* @author Box
*/

import 'regenerator-runtime/runtime';
import React, { PureComponent } from 'react';
import uniqueid from 'lodash/uniqueId';
import noop from 'lodash/noop';
Expand Down
1 change: 1 addition & 0 deletions src/components/ContentSidebar/ContentSidebar.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
* @author Box
*/

import 'regenerator-runtime/runtime';
import React, { PureComponent } from 'react';
import uniqueid from 'lodash/uniqueId';
import noop from 'lodash/noop';
Expand Down
1 change: 1 addition & 0 deletions src/components/ContentTree/ContentTree.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
* @author Box
*/

import 'regenerator-runtime/runtime';
import React, { Component } from 'react';
import { findDOMNode } from 'react-dom';
import classNames from 'classnames';
Expand Down
5 changes: 3 additions & 2 deletions src/components/ContentUploader/ContentUploader.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* @author Box
*/

/* eslint-disable no-param-reassign */
import 'regenerator-runtime/runtime';
import React, { Component } from 'react';
import classNames from 'classnames';
import noop from 'lodash/noop';
Expand Down Expand Up @@ -516,7 +516,8 @@ class ContentUploader extends Component<Props, State> {

if (!useUploadsManager) {
onComplete(cloneDeep(items.map((item) => item.boxFile)));
items = []; // Reset item collection after successful upload
// Reset item collection after successful upload
items = []; // eslint-disable-line
}
}

Expand Down
1 change: 0 additions & 1 deletion src/wrappers/ES6Wrapper.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
import EventEmitter from 'events';
import ReactDOM from 'react-dom';
import { addLocaleData } from 'react-intl';
import 'regenerator-runtime/runtime';
import { DEFAULT_CONTAINER } from '../constants';
import i18n from '../i18n';
import type { StringMap, Token } from '../flowTypes';
Expand Down

0 comments on commit f6ef28d

Please sign in to comment.