Skip to content

Commit b6aa599

Browse files
🎨 [open-formulieren/open-forms#4929] Minor improvements to the StatusUrlPoller component
* Use nullish-check for callback invocation which is a bit more idiomatic Javascript * Throw error instead of just logging it so that it bubbles to the nearest error boundary. This makes the flow of rendering easier to follow/debug/understand.
1 parent 24fcfb5 commit b6aa599

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/components/PostCompletionViews/StatusUrlPoller.jsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,13 @@ const StatusUrlPoller = ({statusUrl, onFailure, onConfirmed, children}) => {
4141
response => {
4242
if (response.result === RESULT_FAILED) {
4343
const errorMessage = response.errorMessage || genericErrorMessage;
44-
if (onFailure) onFailure(errorMessage);
44+
onFailure?.(errorMessage);
4545
} else if (response.result === RESULT_SUCCESS) {
46-
if (onConfirmed) onConfirmed();
46+
onConfirmed?.();
4747
}
4848
}
4949
);
50+
if (error) throw error;
5051

5152
if (loading) {
5253
return (
@@ -71,10 +72,9 @@ const StatusUrlPoller = ({statusUrl, onFailure, onConfirmed, children}) => {
7172

7273
// FIXME: https://github.com/open-formulieren/open-forms/issues/3255
7374
// errors (bad gateway 502, for example) appear to result in infinite loading
74-
// spinners
75-
if (error) {
76-
console.error(error);
77-
}
75+
// spinners. Throwing during rendering will at least make it bubble up to the nearest
76+
// error boundary.
77+
if (error) throw error;
7878

7979
const {
8080
result,

0 commit comments

Comments
 (0)