Skip to content

Commit debbfe7

Browse files
committed
Fix issue with Preact 6.1+ and the JSX mode where object values for the class prop were serialized as objects instead of their normalized string form
1 parent bae73d5 commit debbfe7

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/index.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -113,12 +113,6 @@ export default function renderToString(vnode, context, opts, inner) {
113113
if (name==='children') continue;
114114
if (!(opts && opts.allAttributes) && (name==='key' || name==='ref')) continue;
115115

116-
let hooked = opts.attributeHook && opts.attributeHook(name, v, context, opts, isComponent);
117-
if (hooked || hooked==='') {
118-
s += hooked;
119-
continue;
120-
}
121-
122116
if (name==='className') {
123117
if (attributes['class']) continue;
124118
name = 'class';
@@ -131,6 +125,12 @@ export default function renderToString(vnode, context, opts, inner) {
131125
v = styleObjToCss(v);
132126
}
133127

128+
let hooked = opts.attributeHook && opts.attributeHook(name, v, context, opts, isComponent);
129+
if (hooked || hooked==='') {
130+
s += hooked;
131+
continue;
132+
}
133+
134134
if (name==='dangerouslySetInnerHTML') {
135135
html = v && v.__html;
136136
}

0 commit comments

Comments
 (0)