-
Notifications
You must be signed in to change notification settings - Fork 382
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
Update to Typescript 5 #10535
Update to Typescript 5 #10535
Conversation
resources/js/models/chat/channel.ts
Outdated
@@ -295,7 +295,9 @@ export default class Channel { | |||
|
|||
runInAction(() => { | |||
// gap in messages, just clear all messages instead of dealing with the gap. | |||
const minMessageId = minBy(messages, 'messageId')?.messageId ?? -1; | |||
const maybeMinMessageId = minBy(messages, 'messageId')?.messageId ?? -1; |
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.
?? -1
not needed here?
@@ -50,7 +50,11 @@ export default class ConversationView extends React.Component<Props> { | |||
each(channel.messages, (message: Message, key: number) => { | |||
// check if the last read indicator needs to be shown | |||
// when messageId is a uuid, comparison will always be false. |
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.
this comment can use an update
resources/js/models/chat/channel.ts
Outdated
@@ -295,7 +295,9 @@ export default class Channel { | |||
|
|||
runInAction(() => { | |||
// gap in messages, just clear all messages instead of dealing with the gap. | |||
const minMessageId = minBy(messages, 'messageId')?.messageId ?? -1; | |||
const maybeMinMessageId = minBy(messages, 'messageId')?.messageId ?? -1; | |||
// for typing; realistically, a uuid won't be min unless it's the only value. |
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.
or is it 🤔
> _.minBy([{a:'100asd'},{a:100}], 'a')
Object { a: "100asd" }
first item being a string turned it into a string comparison
resources/js/models/chat/channel.ts
Outdated
return typeof message.messageId === 'number' | ||
? message.messageId | ||
: NaN; |
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.
might as well make a normal loop?
let ret: number|undefined;
for (const m of messages) {
if (typeof m.messageId === 'number' && (ret == null || m.messageId < ret)) {
ret = m.messageId;
}
}
return ret ?? -1;
also add note about fixing/checking getter and variable names
conflicts |
Shouldn't break anything, hopefully 🤔