-
Notifications
You must be signed in to change notification settings - Fork 20
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
Wire up "payment channel updated" events stream to demo #1801
Conversation
✅ Deploy Preview for nitro-payment-demo ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
// It's possible the channel updated before we registered the handler above, so | ||
// query the channel once now to get the latest information: | ||
|
||
setPaymentChannelInfo( | ||
await nitroClient?.GetPaymentChannel(result.ChannelId) | ||
); |
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 is a pretty common issue and makes for pretty bad DX. Perhaps a smarter event queue could be used in place of an event emitter.
@@ -182,25 +177,17 @@ export default function App() { | |||
nitroClient, | |||
(progress) => { | |||
setDownloadProgress(progress); | |||
updateChannelInfo(paymentChannelInfo.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 is the nub of the change. Instead of reaching out with http queries each time we think the channel will have changed, we just listen for events being pushed to us. This should cut down on a bit of latency, I think (round trip vs half round trip).
doesn't seem to be firing at the moment
58e67fb
to
7c6e3f5
Compare
✅ Deploy Preview for nitrodocs ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
Updates the demo to hook the UI into events rather than using timeouts + polling.