diff --git a/src/readthedocs-config.js b/src/readthedocs-config.js index 01fdb446..efb953e1 100644 --- a/src/readthedocs-config.js +++ b/src/readthedocs-config.js @@ -69,17 +69,19 @@ export function getReadTheDocsUserConfig(sendUrlParam) { // this data is ready to be consumed under `event.detail.data()`. const userApiUrl = _getApiUrl(sendUrlParam, metadataAddonsAPIVersion); - fetch(userApiUrl, { - method: "GET", - }).then((response) => { - if (!response.ok) { - return reject( - "Error hitting addons API endpoint for user api-version", - ); - } - // Return the data in the API version requested. - return resolve(response.json()); - }); + return resolve( + fetch(userApiUrl, { + method: "GET", + }).then((response) => { + if (!response.ok) { + return reject( + "Error hitting addons API endpoint for user api-version", + ); + } + // Return the data in the API version requested. + return response.json(); + }), + ); } // If the API versions match, we return `undefined`. @@ -124,8 +126,8 @@ export function getReadTheDocsConfig(sendUrlParam) { // event was fired can still get access to the data globalThis.ReadTheDocsEventData = new ReadTheDocsEventData(dataEvent); - // Trigger the addons data ready CustomEvent to with the data the user is expecting. - return dispatchEvent( + // Trigger the addons data ready CustomEvent with the data the user is expecting. + dispatchEvent( EVENT_READTHEDOCS_ADDONS_USER_DATA_READY, document, new ReadTheDocsEventData(dataEvent), diff --git a/tests/__snapshots__/search.test.snap.js b/tests/__snapshots__/search.test.snap.js index 0c8514de..c268cd51 100644 --- a/tests/__snapshots__/search.test.snap.js +++ b/tests/__snapshots__/search.test.snap.js @@ -1,12 +1,11 @@ /* @web/test-runner snapshot v1 */ export const snapshots = {}; - snapshots["Search tests initial trigger by event and DOM check"] = `