We should skip the same URL#317
Conversation
|
@xiaohulu Thank you, do you mind adding a unit test for the change? |
Codecov Report
@@ Coverage Diff @@
## master #317 +/- ##
==========================================
- Coverage 97.2% 97.18% -0.02%
==========================================
Files 99 99
Lines 5365 5367 +2
Branches 1202 1203 +1
==========================================
+ Hits 5215 5216 +1
- Misses 150 151 +1
Continue to review full report at Codecov.
|
Codecov Report
@@ Coverage Diff @@
## master #317 +/- ##
==========================================
+ Coverage 97.2% 97.25% +0.05%
==========================================
Files 99 100 +1
Lines 5365 5397 +32
Branches 1202 1213 +11
==========================================
+ Hits 5215 5249 +34
+ Misses 150 148 -2
Continue to review full report at Codecov.
|
|
I do not know how to run I write the unit test code here, I do not know if it can pass. it('update path, skip the same path', () => {
const history = new StateHistory({ onChange, window: sandbox.contentWindow! });
history.set('foo');
history.set('bar');
history.set('bar');
sandbox.contentWindow!.history.back();
assert.equal(history.current, '/foo');
assert.equal(sandbox.contentWindow!.location.pathname, '/foo');
}); |
|
@xiaohulu Hmmm that's interesting, I seem to be able to run the tests (on mac, node: v8.9.1 and npm: 6.4.1). Have you tried, removing and reinstalling node_modules (and removing the package-lock too)? |
| } | ||
|
|
||
| public set(path: string) { | ||
| if (path === this._window.location.pathname) { |
There was a problem hiding this comment.
@xiaohulu Do you think we should move the logic from _onChange that does a check against the current and previous value to set function?
const pathName = this._window.location.pathname.replace(/\/$/, '');
const value = stripBase(this._base, pathName + this._window.location.search);
if (this._current === value) {
return;
}…nd previous value to set function
|
@agubler What is the |
|
@xiaohulu Thanks! |
Type: bug
The following has been addressed in the PR:
prettieras per the readme code style guidelinesDescription:
I use
Linkwidget to navigate, but If I click the sameLinkn times, I must click Back button n times to back to previous route. We should skip the same url.