-
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
Expose fatalErrors API from the Start contract #55300
Conversation
This API is intended to be used for runtime as well.
Pinging @elastic/kibana-platform (Team:Platform) |
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.
LGTM, as long as we are exposing this in setup
, it makes sense to do the same in start
.
On an architectural point of view however, I'm wondering if exposing this API to plugin is really a good thing. Now that Kibana is going to be a 'real' SPA, does that really make sense to be able to halt the whole client-side application 'only' based on a plugin decision/error? Am I the only one that this bother, or should I create an issue to discuss this point?
return fatalErrorsSetup; | ||
public start() { | ||
const { fatalErrors } = this; | ||
if (!fatalErrors) throw new Error('FatalErrorsService#setup() must be invoked before start.'); |
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.
NIT/discussion: Personal opinion, but I always avoided one-liner blocks without brackets. Our linter configuration does not complains so this is not an issue, but do we have conventions on that?
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.
no lint rule === no convention. I can update anyway to avoid confusion.
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.
Not necessary, as I said, linter is alright with this, so no need to change imho
It's a substitution for the legacy
which used mostly to render an error message for the failed operation. I do agree it can be misused easily. OTOH I can imagine that plugins do need such API in SPA. For example, a data sync operation in the background fails, a plugin might want to prevent any future user interactions to avoid data inconsistency. Having said that I think it's a legitimate case for a plugin to use this API, but every case should be considered separately. |
It does by erasing the whole dom content of the page in current implementation though. kibana/src/core/public/fatal_errors/fatal_errors_service.tsx Lines 109 to 127 in 812c950
but that's outside of the scope of the PR. |
@elasticmachine merge upstream |
💚 Build SucceededHistory
To update your PR or re-run it, just comment with: |
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.
AppArch changes LGTM.
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.
LGTM
* Expose FatalErrors from the Start contract. This API is intended to be used for runtime as well. * update docs * update data plugin snapshot to fix tests * address comments Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
* master: [State Management] remove AppState from Dashboard app (elastic#54105) Expose fatalErrors API from the Start contract (elastic#55300) [BUG] Data fetching twice on discover timefilter change (elastic#55279) [Mappings editor] Add missing max_shingle_size parameter to search_as_you_type (elastic#55161) [Logs UI] Fix z-index of logs page toolbar (elastic#54469) removes CTA from Task Manager info message (elastic#55334)
* Expose FatalErrors from the Start contract. This API is intended to be used for runtime as well. * update docs * update data plugin snapshot to fix tests * address comments Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com> Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
Summary
This API intended to be used for runtime exceptions. To improve DX, we should provide it as a part of the
start
contract as well.Checklist
Use
strikethroughsto remove checklist items you don't feel are applicable to this PR.[ ] This was checked for cross-browser compatibility, including a check against IE11[ ] Any text added follows EUI's writing guidelines, uses sentence case text and includes i18n support[ ] Unit or functional tests were updated or added to match the most common scenarios[ ] This was checked for keyboard-only and screenreader accessibilityFor maintainers