-
-
Notifications
You must be signed in to change notification settings - Fork 432
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
Conversation
feat: Allow custom classnames in LinkButton feat: Add mt-0 class
feat: Disconnect shows state "Disconnecting..." when deleting item
fix: Use key in the correct place
feat: Show Blog/Blogs in the title depending on the number of items
@amanharwara please pull in standardnotes:develop to your branch to resolve conflicts :) |
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.
Some small finesse changes needed for code consistency and type-safety, otherwise good work! :)
refactor: Use FunctionalComponent type
Made the change from react to preact hooks and |
<Button | ||
type="danger" | ||
label={isDisconnecting ? 'Disconnecting...' : 'Disconnect'} | ||
disabled={disabled} |
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 the isDeleting
one on the parent component
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.
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.
if (shouldDisconnect) { | ||
disconnect(item); | ||
} else { | ||
setIsDisconnecting(false); |
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 a finally
block to ensure it executes even if there's 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.
Putting it in the finally
block turns it off even before it finishes disconnecting, since the deleteItem()
function is async. I've just put setIsDisconnecting(false)
in the catch
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 use async/await
which is a bit easier to read I think
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.
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 and setIsDisconnecting()
inside the .finally()
block.
@amanharwara really nice job! 🙂 |
fix: Set state to false even if errors refactor: Use ternary operator for Getting Started section
Hi everyone, |
This PR adds a new preferences pane for integration with Listed. When there are no current Listed installations, the pane shows information about Listed and how to get started:
When there are present Listed installations, it shows a list of the blogs with options to open the blog, open the settings and disconnect the blog:
When the disconnect button is pressed, it shows a confirmation dialog before disconnecting: