-
Notifications
You must be signed in to change notification settings - Fork 606
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
Prevent video time from getting assigned NaN when frame rate is undefined #5155
Conversation
WalkthroughThe changes involve an update to the Changes
Suggested reviewers
Poem
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
Documentation and Community
|
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.
Actionable comments posted: 0
🧹 Outside diff range and nitpick comments (1)
app/packages/looker/src/elements/util.ts (1)
108-109
: Approve with suggestion: Use Number.isFinite for stricter type checkingThe change successfully prevents NaN values from being returned when frame rate is undefined, which aligns with the PR objective. However, we should use
Number.isFinite()
instead ofisFinite()
for stricter type checking.Apply this change for better type safety:
const time = (frameNumber - 1 + 0.01) / frameRate; - return isFinite(time) ? time : 0.0; + return Number.isFinite(time) ? time : 0.0;Rationale:
Number.isFinite()
is preferred overisFinite()
because:
- It doesn't attempt type coercion
- It strictly checks if the value is a finite number
- It's more predictable and safer
🧰 Tools
🪛 Biome
[error] 109-109: isFinite is unsafe. It attempts a type coercion. Use Number.isFinite instead.
See the MDN documentation for more details.
Unsafe fix: Use Number.isFinite instead.(lint/suspicious/noGlobalIsFinite)
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
📒 Files selected for processing (1)
app/packages/looker/src/elements/util.ts
(1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
app/packages/looker/src/elements/util.ts (1)
Pattern **/*.{ts,tsx}
: Review the Typescript and React code for conformity with best practices in React, Recoil, Graphql, and Typescript. Highlight any deviations.
🪛 Biome
app/packages/looker/src/elements/util.ts
[error] 109-109: isFinite is unsafe. It attempts a type coercion. Use Number.isFinite instead.
See the MDN documentation for more details.
Unsafe fix: Use Number.isFinite instead.
(lint/suspicious/noGlobalIsFinite)
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.
🚀
What changes are proposed in this pull request?
Prevent video time from getting assigned NaN when frame rate is undefined. This currently causes a crash during playback; with this change, playback will be disabled if the frame rate is undefined, but will not crash.
How is this patch tested? If it is not, please explain why.
local app
Release Notes
Is this a user-facing change that should be mentioned in the release notes?
notes for FiftyOne users.
(Details in 1-2 sentences. You can just refer to another PR with a description
if this PR is part of a larger change.)
What areas of FiftyOne does this PR affect?
fiftyone
Python library changesSummary by CodeRabbit