componentDidMount()

in src/amo/components/RatingManager/index.js [68:92]


  componentDidMount() {
    const { addon, dispatch, errorHandler, userId, userReview } = this.props;

    if (
      errorHandler.hasError() &&
      // A 429 can result when a user tries to post too many ratings and gets
      // throttled. In that case we still want to try to load the rating,
      // especially if the user navigated to a new add-on.
      errorHandler.capturedError.responseStatusCode !== 429
    ) {
      log.warn('Not loading data because of an error');
      return;
    }

    if (userId && userReview === undefined) {
      log.debug(`Loading a saved rating (if it exists) for user ${userId}`);
      dispatch(
        fetchLatestUserReview({
          userId,
          addonId: addon.id,
          errorHandlerId: errorHandler.id,
        }),
      );
    }
  }