Skip to content
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

Detect offline client #126

Closed
wants to merge 3 commits into from
Closed

Detect offline client #126

wants to merge 3 commits into from

Conversation

Blazing-Mike
Copy link
Contributor

@Blazing-Mike Blazing-Mike commented Feb 24, 2024

Context (Problem, Motivation, Solution)

Link related issues!
#35

Describe Your Changes

Checklist

  • I have performed a self-review of my code
  • I ran make check and fixed resulting issues
  • I ran the relevant tests and they all pass
  • I wrote tests for my new features, or added regression tests for the bug I fixed

Testing

I implemented a modal to display when our app is offline. so how did i test this, i tested this by throttling the network in my devtools and also disconneCTING my device from wifi and this modal appears on the index.tsx and play.tsx page. when i toggle back or reconnect, the modal disaappears

Screen Shot 2024-02-24 at 8 24 53 PM

Cc: @norswap

Copy link
Member

@norswap norswap left a comment

Choose a reason for hiding this comment

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

Nice, let's use a toast for this!

} catch (error) {
throw error; // Rethrow for retries
}
}
Copy link
Member

Choose a reason for hiding this comment

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

Can you move this outside the function and before the useOfflineCheck function?

@@ -0,0 +1,28 @@


export const OfllineStatusModal = () => {
Copy link
Member

Choose a reason for hiding this comment

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

Typo in the name.

Copy link
Member

Choose a reason for hiding this comment

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

I think it would be better to use a non-dismissable toast for this (src/components/ui/sonner.tsx).

See here how that can be done.

If you do that you also don't need any changes to index.tsx and play.tsx.

Also small note: avoid reformatting the code, as that introduces a lot of irrelevant changes to the diff :)
(We will soon introduce linting to avoid these issues.)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ohh nice, I didn't know a component like that exists. I'll check it out and make necessary changes.

For the reformatting I think I have eslint + prettier setup on my IDE. I'll disable it for this project.

@Blazing-Mike Blazing-Mike closed this by deleting the head repository Feb 26, 2024
@Blazing-Mike Blazing-Mike mentioned this pull request Feb 26, 2024
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants