Skip to content

Commit 3a56916

Browse files
committed
stop ts complaining
1 parent 18ae08d commit 3a56916

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

packages/core/src/history.ts

+6-8
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,9 @@ class History {
3737
return
3838
}
3939

40-
cb = cb ?? (() => {})
41-
4240
if (this.preserveUrl) {
43-
return cb()
41+
cb && cb()
42+
return
4443
}
4544

4645
this.current = page
@@ -51,7 +50,7 @@ class History {
5150
// Ensure any previous history.replaceState completes before pushState is executed.
5251
const doPush = () => {
5352
this.doPushState({ page: data }, page.url)
54-
cb()
53+
cb && cb()
5554
}
5655

5756
if (isChromeIOS) {
@@ -142,10 +141,9 @@ class History {
142141
return
143142
}
144143

145-
cb = cb ?? (() => {})
146-
147144
if (this.preserveUrl) {
148-
return cb()
145+
cb && cb()
146+
return
149147
}
150148

151149
this.current = page
@@ -156,7 +154,7 @@ class History {
156154
// Ensure any previous history.pushState completes before replaceState is executed.
157155
const doReplace = () => {
158156
this.doReplaceState({ page: data }, page.url)
159-
cb()
157+
cb && cb()
160158
}
161159

162160
if (isChromeIOS) {

0 commit comments

Comments
 (0)