-
Notifications
You must be signed in to change notification settings - Fork 71
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
Some widgets take a long time before appearing #1069
Comments
I added There are workarounds but they are not simple:
|
We need a simple and effective solution, my solutions are not good enough. |
We may try to filter data on server side with PHP: generate all the tree bur return only the pages that match with the AJAX search. |
We used an alternative solution in order to replace the service that create choices:
# overload service in order to remove business pages
victoire_view_reference.repository:
class: Victoire\Bundle\ViewReferenceBundle\Connector\ViewReferenceWithoutBusinessPagesRepository
arguments:
- "@victoire_view_reference.connector.repository"
- "@victoire_view_reference.transformer_chain"
<?php
namespace Victoire\Bundle\ViewReferenceBundle\Connector;
use Victoire\Bundle\ViewReferenceBundle\Builder\Chain\ViewReferenceTransformerChain;
use Victoire\Bundle\ViewReferenceBundle\Transformer\ArrayToBusinessPageReferenceTransformer;
/**
* Overload the “getChoices” method in order to remove business pages from choices.
*/
class ViewReferenceWithoutBusinessPagesRepository extends ViewReferenceRepository
{
private $repository;
private $transformer;
/**
* ViewReferenceManager constructor.
*
* @param ViewReferenceConnectorRepositoryInterface $repository
* @param ViewReferenceTransformerChain $transformer
*/
public function __construct(ViewReferenceConnectorRepositoryInterface $repository, ViewReferenceTransformerChain $transformer)
{
$this->repository = $repository;
$this->transformer = $transformer;
parent::__construct($repository, $transformer);
}
/**
* {@inheritdoc}
*/
public function getChoices($locale, $refId = null, $depth = 0)
{
$viewsReferences = [];
$decoratorFn = function ($depth, $char0 = '└', $char = '─') {
$decorator = $char0;
for ($i = 0; $i <= $depth; ++$i) {
$decorator .= $char;
}
return $decorator;
};
if (null === $refId) {
$refsId = $this->repository->getAllBy([
'locale' => $locale,
'slug' => '',
]);
} else {
$refsId = $this->repository->getAllBy([
'locale' => $locale,
'parent' => $refId,
]);
}
$refs = $this->repository->getResults($refsId);
foreach ($refs as $reference) {
$viewReferenceTransformer = ViewReferenceManager::findTransformerFromElement($reference);
// Patch: Ignore business pages
if ($viewReferenceTransformer instanceof ArrayToBusinessPageReferenceTransformer) {
continue;
}
$viewReference = $viewReferenceTransformer->transform($reference);
if ($viewReference->getName() != '') {
$decorator = '';
if ($depth > 0) {
$decorator = $decoratorFn($depth).' ';
}
$viewsReferences[$decorator.$viewReference->getName()] = $viewReference->getId();
}
$viewsReferences = array_merge($viewsReferences, $this->getChoices($locale, $viewReference->getId(), $depth + 1));
}
return $viewsReferences;
}
} |
Description
I try to modify a widget Menu. The server returns a response after 93 seconds.
I can't open the dropdowns.
Resolution Ideas
It may be due to the fact that this website contain more than 5000 pages, so the dropdown where we select a site's page take a really long time to be generated.
We could use something like select2 in order to lazy-load the list of pages.
Related to
The text was updated successfully, but these errors were encountered: