async handler()

in src/mixins/apiChangesObserving.js [45:85]


      async handler(newValue, oldValue = null) {
        // if the we go back, and both the query and selectedAPIChangesVersion are false,
        // we dont want to update the URL
        const shouldPushNewUrl = this.shouldUpdateChangesQueryParameter
          && (this.$route.query.changes || newValue);

        if (newValue !== oldValue) {
          if (shouldPushNewUrl) {
            this.$router.push({
              query: {
                ...this.$route.query,

                // Explicitly pass undefined to remove the query parameter.
                changes: newValue || undefined,
              },
            });
          }

          // only display changes nav if query has available options
          this.shouldDisplayChangesNav = !!(newValue && this.availableOptions.has(newValue));

          let apiChanges = null;
          if (newValue && this.availableOptions.has(newValue)) {
            // Update the query parameter when a version has been selected from the changes nav.
            this.shouldUpdateChangesQueryParameter = true;

            let response;
            try {
              response = await fetchAPIChangesForRoute(this.$route, newValue);
            } catch (err) {
              // if the request errors out for some reason, return an empty object
              response = {};
            }
            if (this.shouldDisplayChangesNav) {
              // Make sure the nav is still visible, when we update the changes.
              apiChanges = response;
            }
          }
          this.store.setAPIChanges(apiChanges);
        }
      },