Skip to content

RESERVED_PROPS is optimized away by Google Closure Compiler #12368

Closed
@Deraen

Description

@Deraen

I'm testing running React through Closure optimizations (with ClojureScript), and I've hit problem where e.g. children property gets included in output when using renderToString/staticMarkup:

<p children="foo, ,bar,,1">foo bar1</p>

(the way children value is converted to string could be due to Cljs).

This is due to Google Closure removes all the properties from the RESERVED_PROPS objects, as they aren't statically accessed.

@banga already has fix for ReactElement in #11967 / #11995:

7d50185

But React-dom server has another place with the same problem:

const RESERVED_PROPS = {
children: null,
dangerouslySetInnerHTML: null,
suppressContentEditableWarning: null,
suppressHydrationWarning: null,
};

Unfortunately looks like this isn't fixable by externs or other means by user, so it would be nice to have this fixed here.

(Mostly React already works with Closure optimizations in Cljs, but my test-suite uses renderToStaticMarkup.)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions