Page MenuHomePhabricator

[web] Update button label after successful copy
ClosedPublic

Authored by tomek on Jun 22 2023, 8:55 AM.
Tags
None
Referenced Files
Unknown Object (File)
Wed, Apr 3, 9:26 AM
Unknown Object (File)
Wed, Apr 3, 9:26 AM
Unknown Object (File)
Wed, Apr 3, 9:26 AM
Unknown Object (File)
Wed, Apr 3, 9:25 AM
Unknown Object (File)
Wed, Apr 3, 9:20 AM
Unknown Object (File)
Mar 7 2024, 9:08 PM
Unknown Object (File)
Mar 7 2024, 9:08 PM
Unknown Object (File)
Mar 7 2024, 9:08 PM
Subscribers

Details

Summary

Change button label after successful action.

Depends on D8246

Test Plan

Click copy button and check if the label changes.
Click it repeatedly and check if the label changes back only after 2s. from the last click.
Click it and close modal - nothing should break.

Diff Detail

Repository
rCOMM Comm
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

Harbormaster returned this revision to the author for changes because remote builds failed.Jun 22 2023, 9:18 AM
Harbormaster failed remote builds in B20432: Diff 28006!
tomek requested review of this revision.Jun 23 2023, 1:38 AM
kamil added inline comments.
web/invite-links/view-invite-link-modal.react.js
33–40 ↗(On Diff #28006)

I think this code is duplicated, wondering about wrapping this in a hook, what do you think?

This revision is now accepted and ready to land.Jun 23 2023, 2:40 AM

Create and use resetting state hook

tomek requested review of this revision.Jun 27 2023, 3:53 AM
tomek added inline comments.
web/invite-links/view-invite-link-modal.react.js
33–40 ↗(On Diff #28006)

Good idea! Created a generic hook with resetting state for this.

kamil added inline comments.
lib/hooks/useResettingState.js
9 ↗(On Diff #28150)

probably having (T => T) | T defined as a separate type in hook-types.js as it can be reused might be a good option, but I do not feel strongly about this

This revision is now accepted and ready to land.Jun 27 2023, 6:07 AM
lib/hooks/useResettingState.js
9 ↗(On Diff #28150)

Might be a good idea, but I don't think we're going to use it frequently - we can add it when there are more usages.

lib/hooks/useResettingState.js
1

We generally name files use-resetting-state.js

lib/hooks/useResettingState.js
1

Ah, sorry about that! After all these years it still isn't intuitive to me. Created a diff fixing the name D8368.