Skip to content

Commit 55ffa73

Browse files
committed
refac: make urlHashArray immutable
1 parent 9d05c81 commit 55ffa73

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/core/plugins/deep-linking/layout.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -173,12 +173,13 @@ export default {
173173
return state.get("scrollToKey")
174174
},
175175
isShownKeyFromUrlHashArray(state, urlHashArray) {
176+
let normalizedUrlSegments = urlHashArray.slice()
176177
// If there are more than 2 segments, treat all segments except the last one as the tag
177-
if (urlHashArray.length > 2) {
178-
urlHashArray = [urlHashArray.slice(0, 1).join("/"), urlHashArray.at(-1)]
178+
if (normalizedUrlSegments.length > 2) {
179+
normalizedUrlSegments = [normalizedUrlSegments.slice(0, 1).join("/"), normalizedUrlSegments.at(-1)]
179180
}
180181

181-
const [tag, operationId] = urlHashArray
182+
const [tag, operationId] = normalizedUrlSegments
182183
// We only put operations in the URL
183184
if(operationId) {
184185
return ["operations", tag, operationId]

0 commit comments

Comments
 (0)