kitze/mobx-router

null || '' ??

romazhan opened this issue · 6 comments

window.history.pushState(null, null || '', currentPath);

thdk commented

@polak228 Can you give some more info on this issue? Are you experiencing problems with this line?

Why write null || "?

thdk commented

Ah that's indeed a bit silly 🙂

So it's always ''

Is there a better value than empty string for this argument?

Write just '', it will work faster by 0.0001 seconds

thdk commented

Yes, according to the docs https://developer.mozilla.org/en-US/docs/Web/API/History/pushState it should be empty string as this value is never used and exists only for historical reasons.

Feel free to submit a PR.

Still not sure how you stumbled on this line though but that's none of my business :)

It's just that sometimes I like to dig into someone else's code