~cytrogen/masto-fe

aec3fa35fda50e7f618dcf8b8f14e78a995583f4 — Eugen Rochko 6 years ago 417989a
[Glitch] Fix not being able to directly switch between list timelines in web UI

Port 5bfd802c571a2793bb59ba4540407a6147e82f88 to glitch-soc

Signed-off-by: Thibaut Girka <thib@sitedethib.com>
1 files changed, 17 insertions(+), 0 deletions(-)

M app/javascript/flavours/glitch/features/list_timeline/index.js
M app/javascript/flavours/glitch/features/list_timeline/index.js => app/javascript/flavours/glitch/features/list_timeline/index.js +17 -0
@@ 75,6 75,23 @@ export default class ListTimeline extends React.PureComponent {
    this.disconnect = dispatch(connectListStream(id));
  }

  componentWillReceiveProps (nextProps) {
    const { dispatch } = this.props;
    const { id } = nextProps.params;

    if (id !== this.props.params.id) {
      if (this.disconnect) {
        this.disconnect();
        this.disconnect = null;
      }

      dispatch(fetchList(id));
      dispatch(expandListTimeline(id));

      this.disconnect = dispatch(connectListStream(id));
    }
  }

  componentWillUnmount () {
    if (this.disconnect) {
      this.disconnect();