Skip to content

Commit

Permalink
fix: avoid crashes when suspense cannot be loaded
Browse files Browse the repository at this point in the history
  • Loading branch information
arthurfiorette committed Apr 3, 2024
1 parent 52da1cb commit e61d19d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/curvy-ladybugs-boil.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@kitajs/fastify-html-plugin': patch
---

Avoid crashes when suspense cannot be loaded
6 changes: 4 additions & 2 deletions packages/fastify-html-plugin/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@
const fp = require('fastify-plugin');
const { isTagHtml } = require('./lib/is-tag-html');

// loads SUSPENSE_ROOT
require('@kitajs/html/suspense');
// Loads the suspense component if it wasn't already loaded
if (!globalThis.SUSPENSE_ROOT) {
require('@kitajs/html/suspense');
}

/**
* @type {import('fastify').FastifyPluginCallback<
Expand Down

0 comments on commit e61d19d

Please sign in to comment.