Skip to content
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

[7.x] [Enterprise Search] Move externalUrl helper out of React Context (#78368) #78497

Merged
merged 2 commits into from
Sep 28, 2020

Conversation

cee-chen
Copy link
Contributor

Backports the following commits to 7.x:

…stic#78368)

* Add new/simpler externalUrl helper and initialize it on renderApp

- This uses a simple JS obj to store the enterpriseSearchUrl reference (once on plugin init)
  - This is vs. a class, which needs to be instantiated and passed around - the new obj can be imported flatly at any time
  - I also opted to not convert this into a Kea logic file - after some deliberation I decided against it because it felt really weird as one. It's not storing "state" per se that ever needs to be updated, it's simply a one-time set obj that contains helper functions.
  - There's also some hope that we might eventually not need this helper after the full migration, so the simpler it is to delete the better
- Uses a getter & setter to ensure that we don't accidentally mutate said obj after initialization

* Update all components using get*SearchUrl helpers

* Update tests for updated components

- Mostly just consists of mocking externalUrl and importing that mock

* Remove old ExternalUrl class/context

TODO in next commit: Address kibana_header_actions

* Update Workplace Search Header Actions to use new externalUrl helper

NOTE: this requires a temporary workaround of initializing externalUrl.enterpriseSearch in plugin.ts rather than in renderApp, because renderApp loads *after* the header app does.

I plan on fixing this in a future PR so that setHeaderActionMenu is called AFTER renderApp has done loading (to ensure all the state in headerActions we need is available).
@cee-chen
Copy link
Contributor Author

@elasticmachine merge upstream

@kibanamachine
Copy link
Contributor

💚 Build Succeeded

Metrics [docs]

async chunks size

id value diff baseline
enterpriseSearch 488.4KB -327.0B 488.7KB

page load bundle size

id value diff baseline
enterpriseSearch 21.7KB -2.3KB 24.0KB

History

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

@cee-chen cee-chen merged commit 2e3e63d into elastic:7.x Sep 28, 2020
@cee-chen cee-chen deleted the backport/7.x/pr-78368 branch September 28, 2020 16:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants