componentDidUpdate()

in src/amo/components/AddonsByAuthorsCard/index.js [120:161]


  componentDidUpdate(prevProps: InternalProps) {
    const {
      addonType: oldAddonType,
      authorIds: oldAuthorIds,
      forAddonSlug: oldForAddonSlug,
      location: oldLocation,
    } = prevProps;
    const {
      addonType: newAddonType,
      authorIds: newAuthorIds,
      forAddonSlug: newForAddonSlug,
      location: newLocation,
      pageParam,
      paginate,
    } = this.props;

    if (!newAuthorIds) {
      return;
    }

    const newPage = paginate
      ? oldLocation.query[pageParam] !== newLocation.query[pageParam]
      : false;

    if (
      oldAddonType !== newAddonType ||
      oldForAddonSlug !== newForAddonSlug ||
      !deepEqual(oldAuthorIds, newAuthorIds) ||
      newPage
    ) {
      this.dispatchFetchAddonsByAuthors({
        addonType: newAddonType,
        authorIds: newAuthorIds,
        forAddonSlug: newForAddonSlug,
        page: this.getCurrentPage({
          location: newLocation,
          paginate,
          pageParam,
        }),
      });
    }
  }