Skip to content

Commit

Permalink
Data modules: Reject the promise on XHR error
Browse files Browse the repository at this point in the history
Makes the WordPress data module reject the loading promise on XHR error.
Before this commit, the promise would erroneously resolve even if the
request failed.

Related to #564
  • Loading branch information
adamziel committed Jan 17, 2024
1 parent b285cb6 commit efc7439
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions packages/playground/wordpress/build/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -188,8 +188,7 @@ RUN cat /root/output/wp.js \
| sed -E "s#'[^']*wp\.data'#dependencyFilename#g" \
| sed -E 's#xhr.onerror = #xhr.onerror = onLoadingFailed; const z = #g' \
| sed -E 's#throw new Error\(xhr.+$#onLoadingFailed(event);#g' \
| sed -E 's#runWithFS#runWithFSThenResolve#g' \
| sed -E 's#function runWithFSThenResolve#function runWithFSThenResolve() { runWithFS(); resolve(); }; function runWithFS#g' \
| sed -E "s#Module\['removeRunDependency'\]\(dependencyFilename\);#Module['removeRunDependency'](dependencyFilename); resolve();#g" \
> /tmp/wp.js && \
mv /tmp/wp.js /root/output/wp.js;

Expand Down

0 comments on commit efc7439

Please sign in to comment.