Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

Don't include the accuracy parameter in location events if accuracy could not be determined. #7375

Merged
merged 3 commits into from
Dec 15, 2021
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/components/views/location/LocationPicker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,8 @@ class LocationPicker extends React.Component<IProps, IState> {
position.coords.longitude +
( position.coords.altitude != null ?
`,${ position.coords.altitude }` : '' ) +
`;u=${ position.coords.accuracy }`);
( position.coords.accuracy != null ?
`;u=${ position.coords.accuracy }` : '' );
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

someone is going to walk along and change these to !== and break this, it really quite brittle to be checking for undefined using null

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did wonder if this was the expected pattern...I can just change both

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(You should make this a linter rule btw, I'm a big fan of never using !=.)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fix'd, I believe these can only be number or undefined in the code?

};

private onOk = () => {
Expand Down