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)
Tue, Nov 26, 4:19 AM
Unknown Object (File)
Sat, Nov 23, 2:00 PM
Unknown Object (File)
Sat, Nov 23, 2:00 PM
Unknown Object (File)
Sat, Nov 23, 1:59 PM
Unknown Object (File)
Sat, Nov 23, 1:59 PM
Unknown Object (File)
Sat, Nov 23, 1:59 PM
Unknown Object (File)
Sun, Nov 10, 12:32 PM
Unknown Object (File)
Sat, Nov 2, 10:56 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
No Lint Coverage
Unit
No Test Coverage

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

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

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 ↗(On Diff #28177)

We generally name files use-resetting-state.js

lib/hooks/useResettingState.js
1 ↗(On Diff #28177)

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