Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
feat: add reset and retry buttons to episode cards #176
base: main
Are you sure you want to change the base?
feat: add reset and retry buttons to episode cards #176
Changes from 3 commits
891079a
2bad253
8ccf9d3
35600b1
d928367
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
🛠️ Refactor suggestion
Specify a more precise return type instead of
any
.Using
any
in TypeScript defeats the purpose of type checking and can lead to runtime errors. Define a specific interface or type for the expected response to enhance type safety and code reliability.Apply this diff to specify a proper return type:
Alternatively, define a custom interface for the response:
And update the function signature:
🧰 Tools
🪛 eslint
[error] 18-18: Unexpected any. Specify a different type.
(@typescript-eslint/no-explicit-any)
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.
🧹 Nitpick (assertive)
Simplify the
loadingState
parameter for clarityConsider simplifying the
loadingState
parameter inhandleMediaAction
by passing the setter function directly instead of an object with aset
method. This enhances readability and reduces unnecessary complexity.Apply this diff to update the function signature and usage:
Update the function body accordingly:
And similarly for setting it back to
false
:Update the calls to
handleMediaAction
inresetItem
:And in
retryItem
: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.
🧹 Nitpick (assertive)
Avoid re-throwing caught errors after handling.
Since you're already displaying a toast notification and logging the error, re-throwing it might not be necessary and could interrupt the flow.
Apply this diff to prevent re-throwing the error:
} catch (error) { console.error('Network or unexpected error:', error); toast.error('Network error occurred. Please check your connection and try again.'); - throw error; } finally {
📝 Committable suggestion
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.
🧹 Nitpick (assertive)
Simplify the toggle logic in
handleEpisodeClick
.You can streamline the logic by setting
selectedEpisodeNumber
tonull
if it's already selected, or to the newepisodeNumber
otherwise.Apply this diff for a cleaner implementation:
📝 Committable suggestion
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.
Fix invalid use of
class
directive on components.The
class
andclass:
directives cannot be applied directly to Svelte components like<CirclePower />
. To apply classes or directives, wrap the component in a DOM element or use a spread attribute if the component supports it.Apply this diff to fix the issue:
Repeat the same adjustment for the
<RotateCcw />
component in the retry button.📝 Committable suggestion
🧰 Tools
🪛 eslint
[error] 190-190: Classes can only be applied to DOM elements, not components(invalid-class)
(svelte/valid-compile)
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.
Pass the correct episode ID to
resetItem
andretryItem
functions.Currently, the functions are called with
data.mediaID
, which refers to the entire media item. To target the specific episode, passepisode.id
instead.Apply this diff to fix the IDs being passed:
🧰 Tools
🪛 eslint
[error] 190-190: Classes can only be applied to DOM elements, not components(invalid-class)
(svelte/valid-compile)