Commit 820bd33
committed
fix: prevent redundant patching of History API methods
The previous implementation of patching the History API methods (pushState and replaceState) was causing them to increasingly nest within patched versions of themselves.
To fix this, a new flag `isHistoryPatched` was introduced to prevent redundant patching. The `stopProgressOnHistoryUpdate` function now checks if the flag is already set before applying the patch. Additionally, the flag is set to `true` after the patching is done to ensure it is only applied once.
Reference: TheSGJ/nextjs-toploader#681 parent e68c698 commit 820bd33
1 file changed
+16
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
128 | 128 | | |
129 | 129 | | |
130 | 130 | | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
131 | 138 | | |
132 | 139 | | |
133 | 140 | | |
134 | 141 | | |
135 | 142 | | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
136 | 147 | | |
137 | 148 | | |
138 | 149 | | |
139 | | - | |
| 150 | + | |
140 | 151 | | |
141 | 152 | | |
142 | 153 | | |
143 | 154 | | |
144 | 155 | | |
145 | 156 | | |
146 | | - | |
| 157 | + | |
147 | 158 | | |
| 159 | + | |
| 160 | + | |
148 | 161 | | |
149 | 162 | | |
150 | 163 | | |
| |||
173 | 186 | | |
174 | 187 | | |
175 | 188 | | |
176 | | - | |
177 | 189 | | |
178 | 190 | | |
179 | 191 | | |
| |||
192 | 204 | | |
193 | 205 | | |
194 | 206 | | |
| 207 | + | |
195 | 208 | | |
196 | 209 | | |
197 | 210 | | |
| |||
0 commit comments