Skip to content

Commit 4381502

Browse files
committed
fix initial dashboard widget loading
1 parent 9980bef commit 4381502

5 files changed

Lines changed: 116 additions & 49 deletions

File tree

core/Widget/WidgetConfig.php

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,10 @@ public function getAction()
126126
* Sets (overwrites) the parameters of the widget. These parameters will be added to the URL when rendering the
127127
* widget. You can access these parameters via `Piwik\Common::getRequestVar(...)`.
128128
*
129+
* This applies to widgets rendered through their controller/action request. Client-rendered widgets do not receive
130+
* these parameters automatically and should instead derive request state from the browser context or load data via
131+
* API requests.
132+
*
129133
* @param array $parameters eg. ('urlparam' => 'urlvalue')
130134
* @return static
131135
*/
@@ -139,6 +143,9 @@ public function setParameters($parameters)
139143
/**
140144
* Add new parameters and only overwrite parameters that have the same name. See {@link setParameters()}
141145
*
146+
* Like {@link setParameters()}, these parameters are only used for widgets rendered through their
147+
* controller/action request and are not forwarded automatically to client-rendered widgets.
148+
*
142149
* @param array $parameters eg. ('urlparam' => 'urlvalue')
143150
* @return static
144151
*/
@@ -357,9 +364,13 @@ public function getMiddlewareParameters()
357364
/**
358365
* Marks this widget as client-rendered by a Vue component exported by the given plugin bundle.
359366
*
367+
* Client-rendered widgets do not execute the widget controller/action in a separate request before rendering.
368+
* They should derive dynamic state from the current browser request or load data through API requests instead.
369+
*
360370
* @param string $plugin eg 'Transitions'
361371
* @param string $component eg 'TransitionsPage'
362372
* @return static
373+
* @since 5.10.0
363374
*/
364375
public function setClientSideComponent(string $plugin, string $component)
365376
{
@@ -373,17 +384,23 @@ public function setClientSideComponent(string $plugin, string $component)
373384

374385
/**
375386
* Returns the configured client-rendered component definition.
387+
* @return array{}|array{plugin: string, name: string}
388+
* @since 5.10.0
376389
*/
377390
public function getClientSideComponent(): array
378391
{
379392
return $this->clientSideComponent;
380393
}
381394

382395
/**
383-
* Sets props that should be passed to the client-rendered Vue widget.
396+
* Sets static props that should be passed to the client-rendered Vue widget.
397+
*
398+
* Use this for configuration known when the widget is registered. Request-specific widget parameters are not
399+
* forwarded to client-rendered widgets through this mechanism.
384400
*
385401
* @param array $props
386402
* @return static
403+
* @since 5.10.0
387404
*/
388405
public function setClientSideProps(array $props)
389406
{
@@ -394,6 +411,8 @@ public function setClientSideProps(array $props)
394411

395412
/**
396413
* Returns props configured for the client-rendered Vue widget.
414+
* @return array
415+
* @since 5.10.0
397416
*/
398417
public function getClientSideProps(): array
399418
{

plugins/CoreHome/vue/dist/CoreHome.umd.js

Lines changed: 5 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)