codeforboston / communityconnect

MIT License
23 stars 61 forks source link

Make Copy button revert on SavedResources panel #406

Open acharliekelly opened 4 years ago

acharliekelly commented 4 years ago

As of PR #405, there is a Copy button on the Saved Resources panel. When you click the button, the map view URL (the same URL as would open if you clicked the Share button) is copied to the clipboard, the icon changes from a Copy icon to a Check icon, so the user knows something has happened.

Expected Behavior

However, if resources are added or removed, the icon on the button should revert back to the Copy icon. That is, when the Resource URL no longer matches what is saved to the clipboard, then the icon should switch back.

Current Behavior

Instead, the icon only changes the first time you click it, switching from Copy to Checkmark. It then remains Checkmark no matter what else happens.

Possible Solution

Need a state change on the SavedResources to cause an update for the Copy button. (Could also use a change of the URL to cause the button to update, since both events occur simultaneously.) Point is, we need to trigger a change on the button.