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

[APM] Refactor hooks and context #84615

Merged
merged 5 commits into from
Dec 2, 2020

Conversation

sorenlouv
Copy link
Member

This PR refactors the hooks and context files:

  • Co-locate "context-consuming"-hooks with context (eg. co-locate use_url_params.ts and url_params_context.ts)
  • Move hooks that are only consumed by a single component inline where used (or to the folder where used)
  • adding "*Fetcher" suffix to data fetching hooks to indicate the implications of consuming it (this is different from calling a hook that consumes a context that internally fetches data, eg use_annotations).
  • Change casing from camelCase to snake_case

@sorenlouv sorenlouv requested review from a team as code owners December 1, 2020 10:40
@botelastic botelastic bot added Team:APM All issues that need APM UI Team support Team:Uptime - DEPRECATED Synthetics & RUM sub-team of Application Observability labels Dec 1, 2020
@elasticmachine
Copy link
Contributor

Pinging @elastic/apm-ui (Team:apm)

@elasticmachine
Copy link
Contributor

Pinging @elastic/uptime (Team:uptime)

Comment on lines 22 to 25
import styled from 'styled-components';
import { APIReturnType } from '../../../../services/rest/createCallApmApi';
import { APMError } from '../../../../../typings/es_schemas/ui/apm_error';
import { IUrlParams } from '../../../../context/UrlParamsContext/types';
import { IUrlParams } from '../../../../context/url_params_context/types';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we start importing types like this?
import type { IUrlParams } from '../../../../context/url_params_context/types';

Copy link
Contributor

@cauemarcondes cauemarcondes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. just some suggestions.

@sorenlouv sorenlouv force-pushed the refactor-hooks-context branch from eb7bb6a to 5007f28 Compare December 1, 2020 15:15
@sorenlouv sorenlouv force-pushed the refactor-hooks-context branch from 5007f28 to cabd189 Compare December 1, 2020 23:10
@sorenlouv sorenlouv added release_note:skip Skip the PR/issue when compiling release notes v7.11.0 labels Dec 2, 2020
@sorenlouv
Copy link
Member Author

retest

@kibanamachine
Copy link
Contributor

💚 Build Succeeded

Metrics [docs]

Module Count

Fewer modules leads to a faster build time

id before after diff
apm 1154 1155 +1

Async chunks

Total size of all lazy-loaded chunks that will be downloaded as the user navigates the app

id before after diff
apm 3.1MB 3.1MB +3.0KB

History

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

Copy link
Contributor

@Kerry350 Kerry350 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

UX changes LGTM

@sorenlouv sorenlouv merged commit 452f841 into elastic:master Dec 2, 2020
@sorenlouv sorenlouv deleted the refactor-hooks-context branch December 2, 2020 12:10
gmmorris added a commit to gmmorris/kibana that referenced this pull request Dec 2, 2020
* master: (72 commits)
  Make alert status fetching more resilient (elastic#84676)
  [APM] Refactor hooks and context (elastic#84615)
  Added word break styles to the texts in the item details card. (elastic#84654)
  [Search] Disable "send to background" when auto-refresh is enabled (elastic#84106)
  Add readme for new palette service (elastic#84512)
  Make all providers to preserve original URL when session expires. (elastic#84229)
  [Lens] Show color in flyout instead of auto (elastic#84532)
  [Lens] Use index pattern through service instead of reading saved object (elastic#84432)
  Make it possible to use Kibana anonymous authentication provider with ES anonymous access. (elastic#84074)
  TelemetryCollectionManager: Use X-Pack strategy as an OSS overwrite (elastic#84477)
  migrate away from rest_total_hits_as_int (elastic#84508)
  [Input Control] Custom renderer (elastic#84423)
  Attempt to more granularly separate App Search vs Workplace Search vs shared GitHub notifications (elastic#84713)
  [Security Solutino][Case] Case connector alert UI (elastic#82405)
  [Maps] Support runtime fields in tooltips (elastic#84377)
  [CCR] Fix row actions in follower index and auto-follow pattern tables (elastic#84433)
  [Enterprise Search] Migrate shared Indexing Status component (elastic#84571)
  [maps] remove fields from index-pattern test artifacts (elastic#84379)
  Add routes for use in Sources Schema (elastic#84579)
  Changes UI links for drilldowns (elastic#83971)
  ...
sorenlouv added a commit that referenced this pull request Dec 2, 2020
* Refactor hooks and context

* Fix tsc issues

* address feedback

* Fix lint

* type-only import
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release_note:skip Skip the PR/issue when compiling release notes Team:APM All issues that need APM UI Team support Team:Uptime - DEPRECATED Synthetics & RUM sub-team of Application Observability v7.11.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants