smbls 3.8.2 → 3.8.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/iife/index.js +14 -14
- package/package.json +1 -1
- package/src/createDomql.js +12 -1
- package/src/router.js +0 -3
package/package.json
CHANGED
package/src/createDomql.js
CHANGED
|
@@ -253,7 +253,15 @@ const hydrateFromBrender = async (app, ctx, doc, win) => {
|
|
|
253
253
|
* CSS stays in <style> tags so re-render is fast (no FOUC for styles).
|
|
254
254
|
*/
|
|
255
255
|
const fallbackRender = async (domqlCreate, app, parentNode, ctx, win) => {
|
|
256
|
-
|
|
256
|
+
const doc = parentNode.ownerDocument || document
|
|
257
|
+
|
|
258
|
+
// Remove SSR emotion CSS — the client emotion instance generates different
|
|
259
|
+
// class names, so keeping the old <style> causes class mismatches.
|
|
260
|
+
// Non-emotion styles (global CSS, reset, font links) are kept for FOUC prevention.
|
|
261
|
+
const ssrEmotionStyle = doc.querySelector('style[data-emotion="smbls"]')
|
|
262
|
+
if (ssrEmotionStyle) ssrEmotionStyle.remove()
|
|
263
|
+
|
|
264
|
+
// Remove brender content (keep non-emotion <style>, <script>, <link>)
|
|
257
265
|
const toRemove = []
|
|
258
266
|
for (const child of parentNode.childNodes) {
|
|
259
267
|
if (child.nodeType === 1) {
|
|
@@ -264,6 +272,9 @@ const fallbackRender = async (domqlCreate, app, parentNode, ctx, win) => {
|
|
|
264
272
|
}
|
|
265
273
|
toRemove.forEach(n => n.remove())
|
|
266
274
|
|
|
275
|
+
// Also remove stale data-br attributes from any remaining elements
|
|
276
|
+
doc.querySelectorAll('[data-br]').forEach(el => el.removeAttribute('data-br'))
|
|
277
|
+
|
|
267
278
|
const smblsApp = await domqlCreate(app, parentNode, ctx.key, {
|
|
268
279
|
verbose: ctx.verbose,
|
|
269
280
|
...ctx.domqlOptions
|
package/src/router.js
CHANGED
|
@@ -62,10 +62,7 @@ export const initRouter = (element, context) => {
|
|
|
62
62
|
return routerOptions
|
|
63
63
|
}
|
|
64
64
|
|
|
65
|
-
let popStateFired
|
|
66
65
|
export const onpopstateRouter = (element, context) => {
|
|
67
|
-
if (popStateFired) return
|
|
68
|
-
popStateFired = true
|
|
69
66
|
const routerOptions = context.router || DEFAULT_ROUTING_OPTIONS
|
|
70
67
|
if (!routerOptions.popState) return
|
|
71
68
|
const router =
|