-
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
[Embeddables Rebuild] Fix runtime state types. #186194
[Embeddables Rebuild] Fix runtime state types. #186194
Conversation
/ci |
/ci |
Pinging @elastic/kibana-presentation (Team:Presentation) |
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.
ML changes LGTM
Pinging @elastic/obs-ux-infra_services-team (Team:obs-ux-infra_services) |
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.
type changes lgtm! added a suggestion, but nothing blocking.
export type FieldListApi = DefaultEmbeddableApi & PublishesSelectedFields & PublishesDataViews; | ||
export type FieldListApi = DefaultEmbeddableApi< | ||
FieldListSerializedStateState, | ||
FieldListSerializedStateState |
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: The RuntimeState type matches the SerializedState type, which makes sense to me. But I wonder if, for the examples, we should specifically add a RuntimeState type like type FieldListRuntimeState = FieldListSerializedStateState
to make it clearer for engineers jumping into the new framework?
Or maybe just a comment explaining that SerializedState and RuntimeState are equivalent?
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.
we could also add RuntimeState and SerializedState to embeddable plugin readme.md to help explain why the 2 versions of state exist and an example (writen, not code) of when they should be different
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.
@nickpeihl I think that is a good idea. I've seen that pattern used in quite a few of the embeddables made by other teams too.
I only wish there was a way to default it to the serialized state and allow implementors to skip adding it - but that isn't possible because of the order of the template.
@nreese I think the documentation is also a good idea, but if it's okay I'll skip that for this PR so that we can get it in ASAP to unblock #186052
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.
Added this in ab4326e
@elasticmachine merge upstream |
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.
Shared UX changes LGTM
💛 Build succeeded, but was flaky
Failed CI StepsMetrics [docs]
History
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.
Type changes LGTM! I agree with @nickpeihl 's suggestion, but I approve this PR to unblock it.
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 🚀
Summary
While working on #186052 I noticed that the
snapshotRuntimeState
interface was being passedserializedState
instead ofruntimeState
which made for some awkward casts and was causing type errors in the PR.I split those changes out into this PR because they unfortunately required me to change the order of the type arguments to the embeddable factory, hence the large number of changes and number of teams pinged. Changes should be type only, but if your Embeddable has no difference between its
serialized
andruntime
state, you'll notice the serialized state type is specified twice to make this explicit.