Avoid rerender cascade

Previously a `js_trigger` event in MMD3's resting state would take about
40ms to render. Now it takes about 4ms.
This commit is contained in:
Jordan Eldredge 2019-09-16 09:05:35 -07:00
parent ed8409b644
commit eb815d2ed1

View file

@ -613,7 +613,7 @@ function XmlChildren({ node }) {
}
// Given a skin XML node, pick which component to use, and render it.
function XmlNode({ node }) {
const XmlNode = React.memo(({ node }) => {
let { name } = node;
if (name == null) {
// name is null is likely a comment
@ -634,7 +634,7 @@ function XmlNode({ node }) {
useJsUpdates(node);
const Component = NODE_NAME_TO_COMPONENT[name] || DummyComponent;
return <Component node={node} {...node.attributes} />;
}
});
function getSkinUrlFromQueryParams() {
const searchParams = new URLSearchParams(window.location.search);