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,41 +250,42 @@ const LocationInfo: React.FC<{}> = () => {
|
||||||
/>
|
/>
|
||||||
</ConversationHeader>
|
</ConversationHeader>
|
||||||
<MessageList>
|
<MessageList>
|
||||||
{notes.features[noteIndex].properties.comments.map(
|
{noteIndex < notes.features.length &&
|
||||||
(comment: any, index: number) => (
|
notes.features[noteIndex].properties.comments.map(
|
||||||
<Message
|
(comment: any, index: number) => (
|
||||||
key={`${notes.features[noteIndex].properties.id}/${index}`}
|
<Message
|
||||||
model={{
|
key={`${notes.features[noteIndex].properties.id}/${index}`}
|
||||||
direction: 'incoming',
|
model={{
|
||||||
position: 'single',
|
direction: 'incoming',
|
||||||
sender: comment.user,
|
position: 'single',
|
||||||
sentTime: comment.date,
|
sender: comment.user,
|
||||||
payload: comment.html,
|
sentTime: comment.date,
|
||||||
}}
|
payload: comment.html,
|
||||||
>
|
}}
|
||||||
<Message.Header
|
>
|
||||||
sender={comment.user}
|
<Message.Header
|
||||||
sentTime={comment.date}
|
sender={comment.user}
|
||||||
/>
|
sentTime={comment.date}
|
||||||
<Message.Footer sentTime={comment.action} />
|
/>
|
||||||
<Avatar
|
<Message.Footer sentTime={comment.action} />
|
||||||
src={AvatarInitial.initialAvatar({
|
<Avatar
|
||||||
size: 100,
|
src={AvatarInitial.initialAvatar({
|
||||||
initials: comment.user ? comment.user : '??',
|
size: 100,
|
||||||
initial_fg: comment.user
|
initials: comment.user ? comment.user : '??',
|
||||||
? 'darkblue'
|
initial_fg: comment.user
|
||||||
: 'lightgrey',
|
? 'darkblue'
|
||||||
initial_bg: comment.user ? 'ivory' : 'darkred',
|
: 'lightgrey',
|
||||||
initial_size: 0, // Defaults to height / 2
|
initial_bg: comment.user ? 'ivory' : 'darkred',
|
||||||
initial_weight: 1000,
|
initial_size: 0, // Defaults to height / 2
|
||||||
initial_font_family:
|
initial_weight: 1000,
|
||||||
"'Lato', 'Lato-Regular', 'Helvetica Neue'",
|
initial_font_family:
|
||||||
})}
|
"'Lato', 'Lato-Regular', 'Helvetica Neue'",
|
||||||
name={comment.user ? comment.user : 'anonymous'}
|
})}
|
||||||
/>
|
name={comment.user ? comment.user : 'anonymous'}
|
||||||
</Message>
|
/>
|
||||||
)
|
</Message>
|
||||||
)}
|
)
|
||||||
|
)}
|
||||||
</MessageList>
|
</MessageList>
|
||||||
</ChatContainer>
|
</ChatContainer>
|
||||||
</MainContainer>
|
</MainContainer>
|
||||||
|
|
Loading…
Reference in New Issue