-
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
[Enterprise Search] Move header actions menu to be rendered after the main app + share its store #78691
Conversation
- This is anticipation of upcoming renderHeaderActions changes which will require these helpers (particularly the unmount portion, for some reason renderHeaderAction tests fail if apps are not unmounted properly) - Add mount/unmount helper (but leave first test the same so that devs can see the normal/expected usage) - Add missing EnterpriseSearch app test - Add mockContainer var for brevity, pull out MockApp in anticipation of future usage
- a light wrapper/helper around params.setHeaderActionMenu + update renderHeaderActions - move to main renderApp block to reflect that its relationship with renderApp ('child'/should be called within renderApp/shares dependencies).
- We need to update WS tests to setMockValues so that it doesn't override the renderHeaderActions mock + bonus - add setMockActions as well because since we're already here + bonus - update App Search index tests as well to match + ?? - for some reason tests were failing beceause react router wasn't mocked properly - requireActual seems to fix that
- set in elastic@9d993d8 - WorkplaceSearchHeaderActions should now still have the correct URL - and also now be able to access all Kea logic set up by the main app :)
Haha fffff. I forgot updating the App Search test would trigger CODEOWNERS. Oh well, worth CCing @JasonStoltz in on this one in any case since we discussed the race condition together in-depth! |
For a working example of header apps being able to access Kea stores, you can check out my header-actions-store-example branch. 🎉 |
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.
This LGTM. Thanks for doing this!
import { ApplicationStart, ChromeBreadcrumb } from 'src/core/public'; | ||
|
||
export interface IKibanaValues { | ||
config: { host?: string }; | ||
navigateToUrl: ApplicationStart['navigateToUrl']; | ||
setBreadcrumbs(crumbs: ChromeBreadcrumb[]): void; | ||
setDocTitle(title: string): void; | ||
renderHeaderActions(HeaderActions: FC): void; |
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.
TIL typing this way 💯
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.
It felt weird importing all of React just for React.FC so I destructured it out. Totally agreed it looks weirdly naked though haha
Thanks Byron!! 🙇♀️ |
💚 Build SucceededMetrics [docs]async chunks size
distributable file count
page load bundle size
History
To update your PR or re-run it, just comment with: |
… main app + share its store (#78691) (#78866) * [Setup] Refactor renderApp tests - This is anticipation of upcoming renderHeaderActions changes which will require these helpers (particularly the unmount portion, for some reason renderHeaderAction tests fail if apps are not unmounted properly) - Add mount/unmount helper (but leave first test the same so that devs can see the normal/expected usage) - Add missing EnterpriseSearch app test - Add mockContainer var for brevity, pull out MockApp in anticipation of future usage * Store renderHeaderActions in KibanaLogic - a light wrapper/helper around params.setHeaderActionMenu + update renderHeaderActions - move to main renderApp block to reflect that its relationship with renderApp ('child'/should be called within renderApp/shares dependencies). * Update WorkplaceSearch to render its header actions from app, not plugin.ts * Update WorkplaceSearch tests (+ bonus refactor) - We need to update WS tests to setMockValues so that it doesn't override the renderHeaderActions mock + bonus - add setMockActions as well because since we're already here + bonus - update App Search index tests as well to match + ?? - for some reason tests were failing beceause react router wasn't mocked properly - requireActual seems to fix that * 🔥 Remove temporary externalUrl workaround - set in 9d993d8 - WorkplaceSearchHeaderActions should now still have the correct URL - and also now be able to access all Kea logic set up by the main app :)
Summary
This is (hopefully) the final PR related to our Kea/store refactors, and solves the app race condition discussed in #78368 (comment). 🎉
What changed:
plugin.ts
. They should instead do so from their respective app indexes: 6925b13As always, I recommend following along by commit.
QA/Regression testing
http://localhost:3002/ws/search
Checklist