Skip to content

Commit 68f6fde

Browse files
perf(operation): limit number of rerenders (#10796)
1 parent c8d7109 commit 68f6fde

4 files changed

Lines changed: 13 additions & 9 deletions

File tree

src/core/components/operation.jsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,8 @@ export default class Operation extends PureComponent {
9090
let isShownKey = ["operations", tag, operationId]
9191
let extensions = getExtensions(operation)
9292

93-
const Responses = getComponent("responses")
94-
const Parameters = getComponent( "parameters" )
93+
const Responses = getComponent("responses", true)
94+
const Parameters = getComponent( "parameters", true )
9595
const Execute = getComponent( "execute" )
9696
const Clear = getComponent( "clear" )
9797
const Collapse = getComponent( "Collapse" )

src/core/components/operations.jsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import React from "react"
22
import PropTypes from "prop-types"
3-
import Im from "immutable"
43

54
export default class Operations extends React.Component {
65

@@ -66,7 +65,7 @@ export default class Operations extends React.Component {
6665
operations.map(op => {
6766
const path = op.get("path")
6867
const method = op.get("method")
69-
const specPath = Im.List(["paths", path, method])
68+
const specPath = op.get("specPath")
7069

7170
if (validOperationMethods.indexOf(method) === -1) {
7271
return null

src/core/plugins/spec/selectors.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,8 @@ export const operations = createSelector(
142142
path: pathName,
143143
method,
144144
operation,
145-
id: `${method}-${pathName}`
145+
id: `${method}-${pathName}`,
146+
specPath: ["paths", pathName, method],
146147
}))
147148
})
148149
})

test/unit/core/plugins/spec/selectors.js

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1089,7 +1089,8 @@ describe("taggedOperations", function () {
10891089
id: "get-/",
10901090
method: "get",
10911091
path: "/",
1092-
operation: op
1092+
operation: op,
1093+
specPath: ["paths", "/", "get"]
10931094
}]
10941095
}
10951096
})
@@ -1134,7 +1135,8 @@ describe("taggedOperations", function () {
11341135
id: "get-/",
11351136
method: "get",
11361137
path: "/",
1137-
operation: op
1138+
operation: op,
1139+
specPath: ["paths", "/", "get"]
11381140
}]
11391141
}
11401142
})
@@ -1173,7 +1175,8 @@ describe("taggedOperations", function () {
11731175
id: "get-/",
11741176
method: "get",
11751177
path: "/",
1176-
operation: op
1178+
operation: op,
1179+
specPath: ["paths", "/", "get"]
11771180
}]
11781181
}
11791182
})
@@ -1212,7 +1215,8 @@ describe("taggedOperations", function () {
12121215
id: "get-/",
12131216
method: "get",
12141217
path: "/",
1215-
operation: op
1218+
operation: op,
1219+
specPath: ["paths", "/", "get"]
12161220
}]
12171221
}
12181222
})

0 commit comments

Comments
 (0)