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
Avoid loading widget urls twice #18665
Conversation
widgetParams(parameters: QueryParameters) { | ||
if (parameters) { | ||
widgetParams(parameters: QueryParameters, oldParameters: QueryParameters) { | ||
if (parameters && JSON.stringify(parameters) !== JSON.stringify(oldParameters)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If this is also executed on mount, the mounted() code could just be removed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wasn't sure if that is always the case or some kind of race condition because of the angularjs <> vue mixup maybe.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm, I'll investigate as I don't understand exactly what's happening here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I couldn't reproduce this, tried in the dashboard and in a report page. It's possible the parameters object is set to a new object that has the exact same value, maybe when loading the same page? If it's something you could reproduce it would be good to figure out where JSON.stringify(oldParameters) === JSON.stringify(newParameters)
gets triggered (via debugger;
for instance). Not doing anything in this case might result in nothing happening when the user tries to reload the current page (ie, user is on Visitors Overview, then clicks Visitors Overview to reload the widgets).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@diosmosis It only happens on the admin page and only with disabled developer mode (merged assets).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Description:
@diosmosis It seems that watching the parameters is also triggered after the component was mounted, currently causing the widget url to be loaded twice.
Tried avoiding that by checking if the parameters actually changed. Locally that worked well. Or is there a better solution for that?
fixes #18662
Review