Skip to content

Fix "follow hashtag" toggle

Zach Oakes requested to merge oakes/follow-hashtag into develop

If you go to a hashtag timeline, then go to a different hashtag timeline, the "follow hashtag" toggle does not change when you click it. The network request goes through, but the toggle remains in its original position.

I found that this is because the useEffect that is requesting the tag data is not being passed the id in the second argument, so it isn't reacting when the id changes.

In the process I also set a default value for the Toggle component's checked property, just like the RadioItem component. Without it, we are passing undefined which triggers this warning in the console:

A component is changing an uncontrolled input to be controlled. This is likely caused by the value changing from undefined to a defined value, which should not happen. Decide between using a controlled or uncontrolled input element for the lifetime of the component.

Merge request reports

Loading