-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
Fix Canvas double render by preventing workpad and assets from being reloaded if it's already available #114712
Fix Canvas double render by preventing workpad and assets from being reloaded if it's already available #114712
Conversation
Pinging @elastic/kibana-presentation (Team:Presentation) |
466cdcb
to
2a52e15
Compare
@elasticmachine merge upstream |
2a52e15
to
4f1dc4b
Compare
@elasticmachine merge upstream |
4f1dc4b
to
deee03b
Compare
…reloaded if it's already available
deee03b
to
9642b86
Compare
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.
Looks good. Great job taking care of that.
}, [workpadId, dispatch, setError, loadPages, workpadResolve]); | ||
|
||
useEffect(() => { | ||
(async () => { |
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.
Is there a reason this needs to be in an async function, vs just running synchronously?
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'll rip this out real quick -- good catch
💚 Build SucceededMetrics [docs]Async chunks
History
To update your PR or re-run it, just comment with: |
…reloaded if it's already available (elastic#114712) * Fix Canvas double render by preventing workpad and assets from being reloaded if it's already available * Better fix * Another fix * updating tests * updating tests again * remove unused async
💚 Backport successful
This backport PR will be merged automatically after passing CI. |
…reloaded if it's already available (#114712) (#115610) * Fix Canvas double render by preventing workpad and assets from being reloaded if it's already available * Better fix * Another fix * updating tests * updating tests again * remove unused async Co-authored-by: Poff Poffenberger <[email protected]>
Summary
Fixes #114340
The problem is caused by the
getRedirectPath
and how it's being passed to theuseWorkpad
hook. ThegetRedirectPath
callback is updated whenever a redirect happens or a page is changed within the workpad. This was causing the hook withinuseWorkpad
to change since one of its dependencies (getRedirectPath
) was changing and it reloaded everything on the workpad.My proposed fix here is to the useWorkpad hook into two effects:
Now, when redirect path is changed with a page update or redirect, the workpad won't be re-loaded again.