Skip to content
Snippets Groups Projects
Commit 92f1d644 authored by Paul Kaplan's avatar Paul Kaplan
Browse files

Cache Renderer.isSupported because it takes 30ms every time

parent bfdc1db2
No related branches found
No related tags found
No related merge requests found
......@@ -33,6 +33,10 @@ const messages = defineMessages({
}
});
// Cache this value to only retreive it once the first time.
// Assume that it doesn't change for a session.
let isRendererSupported = null;
const GUIComponent = props => {
const {
activeTabIndex,
......@@ -66,7 +70,9 @@ const GUIComponent = props => {
tabSelected: classNames(tabStyles.reactTabsTabSelected, styles.isSelected)
};
const isRendererSupported = Renderer.isSupported();
if (isRendererSupported === null) {
isRendererSupported = Renderer.isSupported();
}
return (
<Box
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment