-
Notifications
You must be signed in to change notification settings - Fork 70
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
Creation and Submission delay and status #457
base: dev
Are you sure you want to change the base?
Conversation
This diff is wonky too. For some reason it's showing all my commits as your commits. I don't know what you're doing to make that happen, but can you reset/rebase to clean it up? |
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.
You'll need to rebase this on dev since I merged the groups stuff. Also, take a look at @welshman/app's thunk
module, it solves a lot of these problems much more cleanly. I'm not sure if we can integrate it cleanly yet, but see if you run into any problems with that.
So I tried, for the NoteCreate, it's ok, I can watch the thunk status and take action depending on it (clear the modal, show the toaster etc). The canceled is handled with thunk.controller.abort(). Which is cleaner than keeping a cancel state in the component. For the reply, it's feasible too but the thunk will have to travel across 3 or 4 components like this. Atm I am using the publish command that populates the $publishes store, I can then import directly in NotePending and check out the state of my pub. It seems cleaner. |
Look for the
I'm actually hoping to migrate from publishes to thunks (which are a superset of the functionality), this issue is actually a step in that migration. We can just add these to |
ok I'll make the migration to thunk, almost there |
Just finished the thunk migration and rebased from dev Might be worth another look |
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.
.husky/pre-commit
Outdated
@@ -1 +1 @@ | |||
npm run check | |||
npm run format && npm run check |
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.
npm run format && npm run check | |
npm run check |
- slider to define send_delay
@@ -138,7 +133,7 @@ | |||
id: note.id, | |||
anonymous: Boolean(note.wrap), | |||
}) | |||
.cx({callback: addToContext}) | |||
.cx({callback: repository.publish}) |
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.
This can actually be removed. We might be able to get rid of callback
from Zap as well if it's not used anywhere else.
$: total = thunk.request.relays.length | ||
$: pending = Object.values($status).filter(s => s.status === PublishStatus.Pending).length |
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.
This needs to remove LOCAL_RELAY_URL from the count
@@ -139,11 +140,28 @@ | |||
], | |||
}), | |||
}) | |||
const thunk = publish({ | |||
event: template, | |||
relays: ctx.app.router.PublishEvent(template).getUrls(), |
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.
This template doesn't have a pubkey yet, so random relays are selected. You'll need to sign the event first.
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.
Also, when using nip 46, there's a pretty long delay before a note gets published. This isn't really part of this PR, but go ahead and add loading to NoteCreate to avoid double publishes.
<Field> | ||
<div slot="label" class="flex justify-between"> | ||
<strong>Send Delay</strong> | ||
<div>{values.send_delay} ms</div> | ||
</div> | ||
<Input type="range" step="500" bind:value={values.send_delay} min={0} max={15_000}></Input> | ||
<p slot="info">A delay period allowing you to cancel a reply or note creation, in seconds.</p> | ||
</Field> |
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.
Let's display seconds instead of ms. A step of 1 is fine
export const publishes = withGetter(writable<Record<string, PublishInfo>>({})) | ||
export const groupHints = withGetter(writable<Record<string, string[]>>({})) |
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.
groupHints is old code, it can be removed
{#key "key"} | ||
{#key $toast.id} |
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.
This was actually correct, it's to avoid an animation when there is already a toast visible. Unless something changed?
This PR address issues #369 and #235
When replying, there is a (configurable) 5 seconds countdown before the note is sent
Once the note is sent, it tracks the pending requests via a loading bar
Once all request are settled, it shows a status summary, with the possibility to open a more detailed modal
The post status is displayed for 30 seconds, after which the actions buttons shows up like a normal note