8000 stop mutating inputs by nicolaskruchten · Pull Request #58 · plotly/react-plotly.js · GitHub
[go: up one dir, main page]

Skip to content

stop mutating inputs #58

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already 8000 on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 7, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions src/factory.js
Original file line number Diff line number Diff line change
Expand Up @@ -175,8 +175,8 @@ export default function plotComponentFactory(Plotly) {
}
}

syncWindowResize(props, invoke) {
props = props || this.props;
syncWindowResize(propsIn, invoke) {
const props = propsIn || this.props;
if (!isBrowser) return;

if (props.fit && !this.fitHandler) {
Expand Down Expand Up @@ -211,9 +211,9 @@ export default function plotComponentFactory(Plotly) {
}

// Attach and remove event handlers as they're added or removed from props:
syncEventHandlers(props) {
syncEventHandlers(propsIn) {
// Allow use of nextProps if passed explicitly:
props = props || this.props;
const props = propsIn || this.props;

for (let i = 0; i < eventNames.length; i++) {
const eventName = eventNames[i];
Expand Down Expand Up @@ -244,9 +244,9 @@ export default function plotComponentFactory(Plotly) {
return objectAssign({}, layout, this.getSize(layout));
}

getSize(layout) {
getSize(layoutIn) {
let rect;
layout = layout || this.props.layout;
const layout = layoutIn || this.props.layout;
const layoutWidth = layout ? layout.width : null;
const layoutHeight = layout ? layout.height : null;
const hasWidth = isNumeric(layoutWidth);
Expand Down
0