Navigation Block: Avoid creating a new array/object on every render#30374
Navigation Block: Avoid creating a new array/object on every render#30374
Conversation
|
This PR's not strictly necessary now that #30311 is merged, but it is a very minor optimisation. |
|
Size Change: -2 B (0%) Total Size: 1.42 MB
ℹ️ View Unchanged
|
|
👍 Optimisation + clearer code |
ellatrix
left a comment
There was a problem hiding this comment.
It's is good practice to keep this out of component render functions, but we should assume that block authors are not doing this. I wonder if we should leave it as is to better expose problems? I don't mind either way.
I was wondering about tests for it. It's easy enough to add a block via a plugin that creates a new array on every render, but not sure how we'd detect the problem, as it doesn't seem like a completely consistent behaviour. |
Description
Same as #30274, the navigation block is also creating new arrays and objects for inner blocks props on every render.
Types of changes
Task
Checklist:
*.native.jsfiles for terms that need renaming or removal).