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

pass device status to DeviceCard, add disconnected icon #354

Merged
merged 8 commits into from
May 28, 2024

Conversation

bohdanprog
Copy link
Collaborator

@bohdanprog bohdanprog commented May 15, 2024

Closes #235

@bohdanprog bohdanprog linked an issue May 15, 2024 that may be closed by this pull request
3 tasks
@bohdanprog bohdanprog marked this pull request as ready for review May 15, 2024 13:37
@bohdanprog bohdanprog self-assigned this May 15, 2024
@bohdanprog bohdanprog requested a review from ErikSin May 15, 2024 14:32
@bohdanprog bohdanprog added MVP Needs to be completed for the initial QA release swmansion dev experience labels May 15, 2024
Copy link
Contributor

@ErikSin ErikSin left a comment

Choose a reason for hiding this comment

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

The device should update when it disconnects here. I have noticed with some playing around that it is working pretty inconsistently. Its registering the device as disconnected only sometimes.

@bohdanprog if you could make that change i was referring to about the boolean.

@EvanHahn can you look into the api.on('local-peers', onPeers); and see if you can find any problems in the backend

src/frontend/sharedComponents/DeviceCard.tsx Outdated Show resolved Hide resolved
@bohdanprog bohdanprog requested a review from ErikSin May 17, 2024 10:30
src/frontend/sharedComponents/DeviceNameWithIcon.tsx Outdated Show resolved Hide resolved
src/frontend/sharedComponents/DeviceCard.tsx Outdated Show resolved Hide resolved
@EvanHahn
Copy link
Contributor

@EvanHahn can you look into the api.on('local-peers', onPeers); and see if you can find any problems in the backend

tl;dr: I think useLocalPeers looks fine to me.

I only see two small issues in useLocalPeers, and I would only expect these bugs to manifest at the very beginning (if at all).

  1. During the initial subscription, it's possible that a local-peers event will fire before api.listLocalPeers() resolves. Here's the code:

    api.on('local-peers', onPeers);
    api
    .listLocalPeers()
    .then(onPeers)
    .catch(err => {
    error = err;
    listeners.forEach(listener => listener());
    });

    Imagine that api.listLocalPeers() starts, then a local-peers event fires, then api.listLocalPeers() resolves. The data might be stale.

  2. If api.listLocalPeers() fails after we're unsubscribed, it might fire listeners unnecessarily.

    Imagine that api.listLocalPeers() starts, then we unsubscribe. This would cause stale listeners to be called.

Again, not sure if these are real issues; I would need to test.

Also, I might have missed something!

Signed-off-by: bohdanprog <bohdan.artiukhov@swmansion.com>
…f github.com:digidem/CoMapeo-mobile into feat/project-settings-your-team-deviced-disconnected
@bohdanprog bohdanprog requested a review from EvanHahn May 21, 2024 06:47
Copy link
Contributor

@EvanHahn EvanHahn left a comment

Choose a reason for hiding this comment

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

LGTM but we should wait for @ErikSin before merging, because it sounds like he was seeing some strange behavior.

@ErikSin
Copy link
Contributor

ErikSin commented May 21, 2024

@EvanHahn on testing, i did the followng: api.on('local-peers', peers => {console.log(peers )}).. And i was getting very inconsistent results when my device was leaving or joining a network. It was not the expected behaviour. so i think it is the backend? But lmk if you want to hop on a call and look at it together

@EvanHahn
Copy link
Contributor

EvanHahn commented May 22, 2024 via email

@EvanHahn
Copy link
Contributor

Looks like there's a merge conflict here. @bohdanprog Could you fix?

Copy link
Contributor

@EvanHahn EvanHahn left a comment

Choose a reason for hiding this comment

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

If there's a bug here, it seems unlikely that it's in this PR. LGTM.

@ErikSin ErikSin dismissed their stale review May 27, 2024 18:09

evan has approved

@bohdanprog bohdanprog merged commit 06e2df8 into main May 28, 2024
3 checks passed
@bohdanprog bohdanprog deleted the feat/project-settings-your-team-deviced-disconnected branch May 28, 2024 06:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dev experience MVP Needs to be completed for the initial QA release swmansion
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Project Settings/ Your Team/ deviced disconnected
4 participants