-
-
Notifications
You must be signed in to change notification settings - Fork 753
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: render Ordertab only when it is active #6583
base: main
Are you sure you want to change the base?
fix: render Ordertab only when it is active #6583
Conversation
✅ Deploy Preview for plone-components canceled.
|
@stevepiercy @ichim-david @davisagli Please provide review. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor change in the change log entry.
This is a nice step forward. Thanks for your work on this. In the video, I noticed two things that I'd like to ask for opinions from the members of both the @plone/volto-accessibility and @plone/volto-team. Please don't make changes yet, but let's get some feedback.
|
Thank you, @stevepiercy, for your suggestions. I completely agree with your first suggestion regarding replacing the icon 🚫 with a "Loading" icon. In fact, I had initially considered implementing this change before raising the PR but decided to keep the existing behavior to gather feedback from the Volto team and accessibility experts. It's great to see that you noticed it too, as it reinforces the need for improvement in this area. Regarding your second suggestion, I think it’s a great idea, but I am concerned that its implementation might conflict with the main issue being addressed. Looking forward to hearing more thoughts from the Volto team and accessibility members on these points! |
bc449af
to
8e02a2c
Compare
@ichim-david please provide review on this. |
@Abhishek-17h technically speaking what you did is what I've asked. The problem is that the UX isn't very good as it takes a long time to load even locally with a very fast MacBook pro.
See if you can introduce a loader to give some info to the user that the panel is loading. I would also try to look at the logic of the component and try to understand why it takes so long to load and if there is anything that can be done to speed it up. If we were to simply merge this change it would be a degradation of service of the order tab for the editor on account on having to wait so long to interact with it, especially on second time interactions on the same page. |
@ichim-david, I have watched your testing video and truly appreciate the time you took to explain everything in detail. I will implement the things you mentioned. Thank you for your guidance! |
f8272ca
to
7b06c00
Compare
@ichim-david have a look now. Ref Video: I don't think we can speed up the rendering of the order tab if we only want to render it when it's active. I've tried many things but haven't had any success. |
@stevepiercy give your feedback also on this. |
2c2e121
to
df5b566
Compare
The animated loading icon looks much better. There are two rendering times: (1) that which the user perceives, and (2) that which is the actual render time after the page is loaded in edit mode, and then the editor clicks the Order tab. To reduce option 1 time, we can pre-load option 2. But that would defeat the purpose of this PR and original issue. I have no idea how to improve option 2. Its slow render time only became apparent after work on this PR was started. At this point, we have a trade-off between either having a quick initial Order tab experience or waiting to initially render the Order tab only when it's active. I don't see the advantage of degrading the editor experience. @ichim-david what is the actual problem with rendering the Order tab when it is not active? Yes, it shows up in Developer Tools, but why is that a bad thing? |
@ichim-david honestly, do you think that this is the way of fixing this one, or we should look into a much deeper fix, fixing the updates on components as we talked some time ago? Maybe we should also put @robgietema in the loop. |
@stevepiercy The problem is that we render another set of drag and drop block clones which re-render on any of the block changes. And this is happening even when the order tab isn't focused and in a page with many blocks and with many text editors it can introduce a performance problem since you start typing and for each character, all of the blocks are re-rendered. Once in the main area and the second time in the order tab area. If we have the order tab rendered only when we actually interact with it, and then we drag and drop the blocks We avoid this extra performance overhead. @sneridagh Since it's not an easy thing to fix I think having the order block rendered only when we interact with it is a good workaround until we are able to make both the inline area and the order area less reactive to a block change which re-renders all of the blocks since it's part of the same drag and drop area. I would also add a setting in the config enabled by default to render the order allowing this feature to also be turned off if someone doesn't want it. |
@ichim-david thanks for the explanation. I'm surprised to learn that the Order items render for every keystroke while editing inside a block, and not only when drag-and-dropping. I assumed it happened only when drag-and-dropping. Is there a purpose for rendering on every keystroke? I also like your suggestion of making it a configurable setting that editors may opt-in to, perhaps explaining the trade-off, until we can optimize the render function. We should explain the trade-offs in the setting UI, of course, and name it well. |
@stevepiercy have a look at this video, I started without audio but after the 1 min mark I also started saying something. volto-re-rendering.mp4 |
LGTM |
@plone/volto-team Can I have a final look and nod for this one, please? Thanks! @ichim-david @stevepiercy all settled on this one? |
008ab55
to
b829d36
Compare
@@ -57,6 +58,7 @@ const Sidebar = (props) => { | |||
); | |||
const [size] = useState(0); | |||
const [showFull, setshowFull] = useState(true); | |||
const [isOrderTabRendered, setIsOrderTabRendered] = useState(false); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks like it can cause unnecessary rerenders. The active index tab is an information we already have two lines below with the tab
variable. In other words, isOrderTabRendered
can simply be something like this, moved after const tab = ...
const isOrderTabRendered = tab === 2;
Is this state needed for some other case I might be missing at this time?
if (data.activeIndex === 2) { | ||
setIsOrderTabRendered(true); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If my assumptions above are correct, this should be removed
</Tab.Pane> | ||
), | ||
pane: | ||
isOrderTabRendered || tab === 2 ? ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If my assumptions above are correct, this can simply be
isOrderTabRendered || tab === 2 ? ( | |
tab === 2 ? ( |
packages/volto/src/icons/loader.svg
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@plone/volto-team don't we have any solution already for loading spinners?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, but I don't know where in the code base. Image upload uses it.
Screen.Recording.2025-02-11.at.3.55.18.PM.mov
I'm OK with it, provided @ichim-david is satisfied, and we create a new issue to capture the future improvements, if y'all agree, specifically:
|
@pnicolli You are right , and I done the same when I raise this PR but it takes so much time to render order tab even though
New behaviour is mentioned in this video
|
b829d36
to
d51ccff
Compare
The video showcases the behavior after the fix:
Screencast from 2025-01-13 09-17-05.webm
Closes #6492