-
Notifications
You must be signed in to change notification settings - Fork 433
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
Debounce page refreshes triggered via Turbo streams #1099
Debounce page refreshes triggered via Turbo streams #1099
Conversation
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.
Great work! A already started adding debounce as well, but this PR makes my work
superfluous. Hopefully my feedback helps to craft the best solution.
e237023
to
624b9c6
Compare
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.
Much more readable now! 🙏 Other than a possible extra test case, I don't have feedback anymore.
0a40b41
to
8a4bd7f
Compare
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.
@brunoprietog Thanks for working on this. I added some minor comments.
8a4bd7f
to
aecd2ac
Compare
@jorgemanrubia I've added the |
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.
Thanks for the changes @brunoprietog. I added a few more comments, but good call noticing we need to account for the change of the property when scheduling the debounce logic.
@@ -177,7 +177,7 @@ test("test action=refresh", async () => { | |||
const element = createStreamElement("refresh") | |||
subject.append(element) | |||
|
|||
await nextBeat() | |||
await sleep(250) |
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.
Could we use nextPageRefresh
instead of the remaining sleep(250)
?
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 helper uses Playwright and we don't have access to it here, that's why I haven't changed it. But you're right that it doesn't read well.
aecd2ac
to
ac5f854
Compare
Fix Turbo 8 refresh debounce in frontend hotwired#1093
ac5f854
to
2147a14
Compare
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.
Thanks @brunoprietog
Fixes #1093