diff --git a/src/Controller/Index/Index.php b/src/Controller/Index/Index.php index da5fb11..244b783 100644 --- a/src/Controller/Index/Index.php +++ b/src/Controller/Index/Index.php @@ -7,20 +7,18 @@ use Magento\Framework\App\Action\Action; use Magento\Framework\App\Action\Context; use Magento\Framework\App\Action\HttpGetActionInterface; +use Magento\Framework\Controller\Result\RawFactory; use Magento\Framework\Escaper; +use Magento\Framework\UrlInterface; class Index extends Action implements HttpGetActionInterface { - private \Magento\Framework\Controller\Result\RawFactory $rawFactory; - private \Magento\Framework\UrlInterface $urlBuilder; + private RawFactory $rawFactory; + private UrlInterface $urlBuilder; private Escaper $escaper; - public function __construct( - Context $context, - \Magento\Framework\Controller\Result\RawFactory $rawFactory, - \Magento\Framework\UrlInterface $urlBuilder, - Escaper $escaper - ) { + public function __construct(Context $context, RawFactory $rawFactory, UrlInterface $urlBuilder, Escaper $escaper) + { parent::__construct($context); $this->rawFactory = $rawFactory; $this->urlBuilder = $urlBuilder; @@ -37,6 +35,9 @@ public function execute() return $rawResponse; } + /** + * @prettier-ignore + */ private function getEmbedScript(): string { return ' @@ -51,7 +52,10 @@ private function getEmbedScript(): string new window.EmbeddedSandbox({ target: "#embedded-sandbox", initialEndpoint: "' . $this->escaper->escapeUrl($this->getGraphqlUrl()) . '", - includeCookies: true + includeCookies: true, + initialState: { + pollForSchemaUpdates: false + } }); @@ -61,6 +65,6 @@ private function getEmbedScript(): string private function getGraphqlUrl(): string { - return rtrim($this->urlBuilder->getBaseUrl([ '_scope' => 0 ]), '/') . '/graphql'; + return rtrim($this->urlBuilder->getBaseUrl(['_scope' => 0]), '/') . '/graphql'; } }