Reinitializing noteIndex when fetching new notes (to avoid out of length indexes).
This commit is contained in:
parent
5a7402313e
commit
304c4d38b7
|
@ -77,6 +77,7 @@ const LocationInfo: React.FC<{}> = () => {
|
|||
|
||||
const findNotes = async () => {
|
||||
setNotes(undefined);
|
||||
setNoteIndex(0);
|
||||
const metresPerDegree =
|
||||
111111 * Math.cos((scope.center.lat * Math.PI) / 180);
|
||||
const deltaDegrees = 2000 / metresPerDegree;
|
||||
|
@ -249,7 +250,8 @@ const LocationInfo: React.FC<{}> = () => {
|
|||
/>
|
||||
</ConversationHeader>
|
||||
<MessageList>
|
||||
{notes.features[noteIndex].properties.comments.map(
|
||||
{noteIndex < notes.features.length &&
|
||||
notes.features[noteIndex].properties.comments.map(
|
||||
(comment: any, index: number) => (
|
||||
<Message
|
||||
key={`${notes.features[noteIndex].properties.id}/${index}`}
|
||||
|
|
Loading…
Reference in New Issue