Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Explain NaN handling
  • Loading branch information
presleyp committed Dec 20, 2022
commit 0ddf307d617952423e21393fb3110028e68ebdf0
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ export const EditHours = ({
const styles = useStyles()

return (
// hours is NaN when user deletes the value, so treat it as 0
<form onSubmit={() => handleSubmit(Number.isNaN(hours) ? 0 : hours)}>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

when is it going to be NaN?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When you delete the number from the input

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we could add a comment explaining this? So we know why we are checking it. Up to you.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea!

<Stack direction="row" alignItems="baseline" spacing={1}>
<TextField
Expand Down