-
Notifications
You must be signed in to change notification settings - Fork 472
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[1.x] Fix setNavigationType
for Safari 10
#1957
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like Safari was one of the latest to add support for this (in 2017). https://developer.mozilla.org/en-US/docs/Web/API/Performance/getEntriesByType#browser_compatibility
Arguably this affects an extremely small % of users, but I don't really see a drawback in adding one additional guard to this ternary.
@derrickreimer Yeah, it's indeed an extremely small % of users, but useful for projects which aim to support a wide variety of browsers. |
@reinink Welcome! By the way, I've checked the code from the link you provided: inertia/packages/core/src/navigationType.ts Lines 5 to 9 in 338b4c2
Unless I'm missing something, I don't think |
Then in this case both will be wrong as you can't call a function if it is undefined even with the Proper signature would be
|
setNavigationType
for Safari 10setNavigationType
for Safari 10
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me, thanks @hivokas!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, thanks!
Thanks! |
@joetannenbaum even though it works in 1.x, it doesn't seem to work in 2.x. Is there a chance this fix could be ported to 2.x? |
Simple fix for Safari 10.
It happens because
this.navigation
is present, butthis.navigation.getEntriesByType
is missing.