This repository was archived by the owner on May 2, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +19
-12
lines changed
Expand file tree Collapse file tree 3 files changed +19
-12
lines changed Original file line number Diff line number Diff line change 11# Changelog
22
3+ ## 0.7.2
4+
5+ ** Bugfixes:**
6+
7+ * Fix race-condition between fetching the gateway details and getting the
8+ current location if the gateway location is not yet set (UI).
9+
310## 0.7.1
411
512** Features & changes:**
Original file line number Diff line number Diff line change 1515 - changelog.md
1616
1717extra :
18- version : ' 0.7.1 '
18+ version : ' 0.7.2 '
1919 github :
2020 download_release : true
2121
Original file line number Diff line number Diff line change @@ -54,20 +54,20 @@ class GatewayForm extends Component {
5454 gateway : this . props . gateway ,
5555 } ) ;
5656
57- if ( typeof ( this . state . gateway . latitude ) === "undefined" || typeof ( this . state . gateway . longitude ) === "undefined" || this . state . gateway . latitude === 0 || this . state . gateway . longitude === 0 ) {
58- this . setToCurrentPosition ( ) ;
59- }
57+ this . setToCurrentPosition ( false ) ;
6058 }
6159
62- setToCurrentPosition ( ) {
60+ setToCurrentPosition ( overwrite ) {
6361 if ( navigator . geolocation ) {
6462 navigator . geolocation . getCurrentPosition ( ( position ) => {
65- let gateway = this . state . gateway ;
66- gateway . latitude = position . coords . latitude ;
67- gateway . longitude = position . coords . longitude ;
68- this . setState ( {
69- gateway : gateway ,
70- } ) ;
63+ if ( overwrite === true || typeof ( this . state . gateway . latitude ) === "undefined" || typeof ( this . state . gateway . longitude ) === "undefined" || this . state . gateway . latitude === 0 || this . state . gateway . longitude === 0 ) {
64+ let gateway = this . state . gateway ;
65+ gateway . latitude = position . coords . latitude ;
66+ gateway . longitude = position . coords . longitude ;
67+ this . setState ( {
68+ gateway : gateway ,
69+ } ) ;
70+ }
7171 } ) ;
7272 }
7373 }
@@ -85,7 +85,7 @@ class GatewayForm extends Component {
8585
8686 handleSetToCurrentPosition ( e ) {
8787 e . preventDefault ( ) ;
88- this . setToCurrentPosition ( ) ;
88+ this . setToCurrentPosition ( true ) ;
8989 }
9090
9191 render ( ) {
You can’t perform that action at this time.
0 commit comments