Skip to content

Commit bc123d7

Browse files
committed
Merge branch 'master' of github.com:elastic/kibana into ingest-code-coverage-WITH-MASTER
2 parents 3dc8c31 + 7707cbd commit bc123d7

79 files changed

Lines changed: 1631 additions & 1421 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/CODEOWNERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,7 @@
166166
/packages/kbn-analytics/ @elastic/pulse
167167
/src/legacy/core_plugins/ui_metric/ @elastic/pulse
168168
/src/plugins/kibana_usage_collection/ @elastic/pulse
169+
/src/plugins/newsfeed/ @elastic/pulse
169170
/src/plugins/telemetry/ @elastic/pulse
170171
/src/plugins/telemetry_collection_manager/ @elastic/pulse
171172
/src/plugins/telemetry_management_section/ @elastic/pulse

src/core/CONVENTIONS.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,36 @@ export class MyPlugin implements Plugin {
201201
}
202202
```
203203

204+
Prefer the pattern shown above, using `core.getStartServices()`, rather than store local references retrieved from `start`.
205+
206+
**Bad:**
207+
```ts
208+
export class MyPlugin implements Plugin {
209+
// Anti pattern
210+
private coreStart?: CoreStart;
211+
private depsStart?: DepsStart;
212+
213+
public setup(core) {
214+
core.application.register({
215+
id: 'my-app',
216+
async mount(params) {
217+
const { renderApp } = await import('./application/my_app');
218+
// Anti pattern - use `core.getStartServices()` instead!
219+
return renderApp(this.coreStart, this.depsStart, params);
220+
}
221+
});
222+
}
223+
224+
public start(core, deps) {
225+
// Anti pattern
226+
this.coreStart = core;
227+
this.depsStart = deps;
228+
}
229+
}
230+
```
231+
232+
The main reason to prefer the provided async accessor, is that it doesn't requires the developer to understand and reason about when that function can be called. Having an API that fails sometimes isn't a good API design, and it makes accurately testing this difficult.
233+
204234
#### Services
205235

206236
Service structure should mirror the plugin lifecycle to make reasoning about how the service is executed more clear.

src/core/public/chrome/ui/header/__snapshots__/collapsible_nav.test.tsx.snap

Lines changed: 31 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)