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 () => {
|
const findNotes = async () => {
|
||||||
setNotes(undefined);
|
setNotes(undefined);
|
||||||
|
setNoteIndex(0);
|
||||||
const metresPerDegree =
|
const metresPerDegree =
|
||||||
111111 * Math.cos((scope.center.lat * Math.PI) / 180);
|
111111 * Math.cos((scope.center.lat * Math.PI) / 180);
|
||||||
const deltaDegrees = 2000 / metresPerDegree;
|
const deltaDegrees = 2000 / metresPerDegree;
|
||||||
|
@ -249,7 +250,8 @@ const LocationInfo: React.FC<{}> = () => {
|
||||||
/>
|
/>
|
||||||
</ConversationHeader>
|
</ConversationHeader>
|
||||||
<MessageList>
|
<MessageList>
|
||||||
{notes.features[noteIndex].properties.comments.map(
|
{noteIndex < notes.features.length &&
|
||||||
|
notes.features[noteIndex].properties.comments.map(
|
||||||
(comment: any, index: number) => (
|
(comment: any, index: number) => (
|
||||||
<Message
|
<Message
|
||||||
key={`${notes.features[noteIndex].properties.id}/${index}`}
|
key={`${notes.features[noteIndex].properties.id}/${index}`}
|
||||||
|
|
Loading…
Reference in New Issue