-
Notifications
You must be signed in to change notification settings - Fork 24
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
Fix onChange on TreeSelelect #907
Fix onChange on TreeSelelect #907
Conversation
@@ -170,7 +170,7 @@ let options2 = [ | |||
] | |||
|
|||
let fetchedArr = []; | |||
fetch('https://nominatim.openstreetmap.org/search/berlin?format=json&addressdetails=1&limit=20').then(response => response.json()).then(data => fetchedArr = data); | |||
fetch('https://nominatim.openstreetmap.org/search.php?q=berlin&exclude_place_ids=134060781&format=jsonv2').then(response => response.json()).then(data => fetchedArr = data); |
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.
inline the values so we don't have to rely on an external API
/* | ||
* This variable is used to distinguish changes coming from outside (from props.value) | ||
* from those made by the user through interaction with the component. | ||
*/ |
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.
Include in the comment is that the purpose is to prevent triggering onChange when props change.
@@ -169,8 +169,24 @@ let options2 = [ | |||
}, | |||
] | |||
|
|||
let fetchedArr = []; | |||
fetch('https://nominatim.openstreetmap.org/search/berlin?format=json&addressdetails=1&limit=20').then(response => response.json()).then(data => fetchedArr = data); | |||
let fetchedArr = [ |
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.
since there's only item there, what's the point to have it at all? What about removing it completelly and simply using one of demo arrays we already have?
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.
initial point was to present real async mode...
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.
async demo is using a timeout to simulate a request delay and fetchedArr
was being accessed synchronously. It makes no difference which data source is being used if they are both accessed synchronously
No description provided.