-
Notifications
You must be signed in to change notification settings - Fork 0
DIsplay a map full of stations and let a user select a station to view data at that station. #14
Conversation
@@ -28,7 +28,7 @@ const StationDetail = class extends Component { | |||
} | |||
|
|||
componentDidMount() { | |||
this.findCurrentLocation() | |||
this.requestLoctionInformation() |
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.
@BlakeWilliams I am calling this on mount so it kicks off the first time (when you open the app for the first time). If you then select a new location via the map, this works as well. Lastly, while within this same state you go to the map and pick another station nothing happens. You see the new screen come in, but no actions are fetched.
Thinking about this now, this is accurate since the component is already mounted? But at the same time that is odd because it works once then stops.
I was hooking into componentWillReceiveProps
and that was fired way too much due to the reducer setting the props after various actions were completed.
Could I still use that method above but do some logic to compare this.props
and nextProps
basically:
if (this.props.location !== this.nextProps) { // kick off a new request }
(Also as I was writing this I thought of that solution, another reason PR's and code reviews are so great. I have had this happen a few times).
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.
Maybe you need two different components. One that fetches current location on mount and another that fetches the one from props?
Found this PR to address the pin issue. Looks like they are allocating a new |
… maps more maps maps more maps maps more maps maps more maps maps more maps maps more maps maps more maps maps
037cc57
to
2212df9
Compare
No description provided.