Skip to content

Commit

Permalink
fix: remove undefined string from flush suspense
Browse files Browse the repository at this point in the history
  • Loading branch information
MatthewPattell committed Apr 19, 2024
1 parent 8bb1f94 commit ef2269a
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/server/stream-suspense.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,10 +104,12 @@ class StreamSuspense {
.replace(suspenseRegexp, replacer)
.replace(suspenseErrorRegexp, replacer)
.replace('<script></script>', '');
const replacersHtml = `<script>${[...suspenseReplacers].join(';')};</script>`;
const replacersHtml =
suspenseReplacers.size > 0 ? `<script>${[...suspenseReplacers].join(';')};</script>` : '';
const callbackHtml = this.callback(suspenseId, errorMessage) || '';

// Return React chunk then custom html then React suspense replacers
return modifiedHtml + this.callback(suspenseId, errorMessage) + replacersHtml;
return modifiedHtml + callbackHtml + replacersHtml;
}

/**
Expand Down

0 comments on commit ef2269a

Please sign in to comment.