From bccb36dda2553ca71724982fdc4c3ae74595509c Mon Sep 17 00:00:00 2001 From: Matchu Date: Tue, 2 Feb 2021 16:56:26 -0800 Subject: [PATCH] Improve SpeciesFacesPicker render performance MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The Tooltip elements seem to still be taking a bit, I don't really know a great workaround for that… could maybe split it out into a separate box and defer the rendering on it, so it doesn't block the first pageload? --- src/app/ItemPage.js | 42 +++++++++++++++++++++++++++--------------- 1 file changed, 27 insertions(+), 15 deletions(-) diff --git a/src/app/ItemPage.js b/src/app/ItemPage.js index b14cd40..ff611b4 100644 --- a/src/app/ItemPage.js +++ b/src/app/ItemPage.js @@ -891,6 +891,8 @@ function SpeciesFaceOption({ const cursor = isLoading ? "wait" : !isCompatible ? "not-allowed" : "pointer"; + // NOTE: Because we render quite a few of these, avoiding using Chakra + // elements like Box helps with render performance! return ( {({ css }) => ( @@ -904,14 +906,12 @@ function SpeciesFaceOption({ // but not when you _change_ options!) isOpen={labelIsHovered || inputIsFocused} > - setLabelIsHovered(true)} onMouseLeave={() => setLabelIsHovered(false)} > - onChange({ speciesId, colorId })} onFocus={() => setInputIsFocused(true)} onBlur={() => setInputIsFocused(false)} - /> - */ + border: 0px; + clip: rect(0px, 0px, 0px, 0px); + height: 1px; + width: 1px; + margin: -1px; + padding: 0px; + overflow: hidden; + white-space: nowrap; + position: absolute; + `} + /> +
- - - +
+ )}