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

Hide network error following an allDataFetched event #293

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

mvastola
Copy link

@mvastola mvastola commented Jan 4, 2022

See #292.

Fixes #292
Fixes #273

@Zren
Copy link
Owner

Zren commented Jan 4, 2022

The allDataFetched signal is probably a bad name. It's really "all async fetches have completed". fetchGoogleAccountEvents_err() will also asyncRequestsDone += 1 which emits allDataFetched() if asyncRequestsDone >= asyncRequests) {.

I'm guessing if you disconnect your network/wifi, the error will still get hidden.

Not sure if I sure remove asyncRequestsDone += 1 from the _err function. I'll need to skim the listeners of AllDataFetched and AsyncRequestsDoneChanged to see if there will be any bugs.

@mvastola
Copy link
Author

mvastola commented Jan 5, 2022

The allDataFetched signal is probably a bad name. It's really "all async fetches have completed". `
I'm guessing if you disconnect your network/wifi, the error will still get hidden.

I actually thought of this and tried it, and it shows and doesn't get hidden if I'm disconnected.

My best guess as to why is that the showError function also gets called for each allDataFetched signal iif the network is down.

I do wonder if that might be due to (or succeptable to) a race condition, but I'm not too familiar with the order of operations and dependencies here. I imagine there's a way to do this that's thread-safe, however.

Not sure if I sure remove asyncRequestsDone += 1 from the _err function. I'll need to skim the listeners of AllDataFetched and AsyncRequestsDoneChanged to see if there will be any bugs.

Please do.

My other idea is (if this implementation doesn't work out) is we can add (in addition to asyncRequestsDone) a new property called asyncRequestsFailed, and if it's zero after the signal, clear the error. (Obviously you'll want to reset it to zero after each fetch all.)

Only reason I didn't go that route is this seemed more straightforward and I don't know the QML syntax well enough to be sure I'm doing it right.

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.

[Request] Hide 'HTTP Error' toast after attempt succeeds HTTP 0 error, could not connect
2 participants