4a604bab0b
- Updated import path for app.server module in SSR hook. - Removed babel.config.server.json as Babel is no longer needed for async/await transformation. - Adjusted esbuild configuration to target ESNext and modified output paths. - Enhanced App.svelte to handle initial content loading during SSR. - Updated SSR script to load messages synchronously before rendering. - Simplified build:server script in package.json by removing Babel step.
23 lines
748 B
JavaScript
23 lines
748 B
JavaScript
var utils = require("./lib/utils")
|
|
|
|
;(function () {
|
|
const col = context.collection()
|
|
const collectionName = col && col.name ? col.name : null
|
|
const req = context.request()
|
|
const method = req.method
|
|
const data = /** @type {Record<string, any>} */ (Array.isArray(context.data) ? {} : context.data || {})
|
|
let entryId = data.id || req.param("id") || null
|
|
|
|
// DELETE hooks may not populate context.data.id or route params consistently.
|
|
if (!entryId) {
|
|
const path = req.path
|
|
const segments = path.split("/")
|
|
const last = segments[segments.length - 1]
|
|
if (last && last.length >= 24) {
|
|
entryId = last
|
|
}
|
|
}
|
|
|
|
utils.clearSSRCache(collectionName, entryId, method)
|
|
})()
|