Perfermance issue in form builder. #497
luckykenlin
started this conversation in
General
Replies: 2 comments
-
|
Experienced this myself. Unfortunately there's no solid way to prevent n+1 issues in the builder with curator. So I overwrote the hydrate and dehydrate on the curator implementation for each builder block to use change the state to not need the extra look up. If that makes sense. |
Beta Was this translation helpful? Give feedback.
0 replies
-
|
For example: class CobblerCuratorPicker extends CuratorPicker
{
protected function setUp(): void
{
parent::setUp();
$this
->afterStateHydrated(function (CuratorPicker $component, $state) {
if (blank($state)) {
$component->state([]);
return;
}
$state = is_array(Arr::first($state)) ? Arr::first($state)['id'] : $state['id'];
$component->state(get_media_items(Arr::wrap($state)));
})
->dehydrateStateUsing(function ($state) {
if (filled($state)) {
$state = Arr::first($state);
return [
'id' => $state['id'],
'path' => $state['path'],
'alt' => $state['alt'] ?? null,
'width' => $state['width'],
'height' => $state['height'],
];
}
return $state;
});
}
} |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi,
I am building a form builder and using a curator picker in the image block.
However, if I add more than 10 pickers, it becomes slow to open the edit page.
Beta Was this translation helpful? Give feedback.
All reactions