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 Listed pane in preferences #651
feat: Add Listed pane in preferences #651
Changes from 12 commits
df98425
79301f1
3b82109
177a4e8
748f3f7
6adb8b4
a1cc5f4
f2b57dd
f101d96
53589d4
754142a
2fe7f93
001e9cc
48ad289
880eadd
4083903
6ebe26b
9282aa3
e8637ee
8c0e143
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.
setIsDisconnecting(false)
would need to go in afinally
block to ensure it executes even if there's an errorThere 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.
Putting it in the
finally
block turns it off even before it finishes disconnecting, since thedeleteItem()
function is async. I've just putsetIsDisconnecting(false)
in thecatch
block to execute it even if there is an error.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.
Shouldn't we await
disconnect
in that case? Might be a good idea to refactor these to useasync/await
which is a bit easier to read I thinkThere 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.
That would require the disconnect function to be promisified. That is actually how I had originally implemented it, but I thought I was overcomplicating it, so I removed the promise.
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.
@antsgar So I've turned the disconnect function into a Promise and using
await disconnect()
in the BlogItem andsetIsDisconnecting()
inside the.finally()
block.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.
Maybe we could use the
isDiconnecting
state variable here and get rid of theisDeleting
one on the parent componentThere 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.
Since the deletion happens asynchronously, I've kept the isDeleting on the parent so the other Disconnect buttons can stay disabled while one is disconnecting to avoid any errors.