-
Notifications
You must be signed in to change notification settings - Fork 920
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
Fix: Re-rendering visualization when expression changes and improves typing #1491
Fix: Re-rendering visualization when expression changes and improves typing #1491
Conversation
Signed-off-by: Ashwin Pc <[email protected]>
Signed-off-by: Ashwin Pc <[email protected]>
Signed-off-by: Ashwin Pc <[email protected]>
Codecov Report
@@ Coverage Diff @@
## main #1491 +/- ##
=======================================
Coverage 68.09% 68.09%
=======================================
Files 3072 3072
Lines 59032 59032
Branches 8928 8928
=======================================
+ Hits 40198 40200 +2
+ Misses 16647 16646 -1
+ Partials 2187 2186 -1
Continue to review full report at Codecov.
|
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.
Looks great Ashwin!
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.
Looks good. Thanks Ashwin
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.
Nice work, and I appreciate the type improvements. A couple minor typing questions.
@@ -79,4 +79,5 @@ export interface IInterpreterRenderHandlers { | |||
reload: () => void; | |||
update: (params: any) => void; | |||
event: (event: any) => void; | |||
uiState?: any; |
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 - shouldn't this be PersistedState
type?
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.
It could. I wasn't a 100% if uiState was always used as PersistedState everywhere. It is used as PersistedState in the viz renderer but other renderers can use other uiState values. To not break anything I just kept the type that was expected everywhere else. I may update this once I can be sure that it won't break anything.
visData: object; | ||
visConfig: object; | ||
params?: object; | ||
visData?: object | null; |
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 - do we need to support null
here? Generally undefined is probably preferable and covered by the optional.
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.
One of the existing visualizations expects a null value for vizData when no data is present. Since I didn't want to introduce a breaking change, I kept the expected types the same and instead just typed the interfaces more strongly.
…typing (opensearch-project#1491) * fix(Expressions): Fixes rendering viz when expression changes Signed-off-by: Ashwin Pc <[email protected]> * chore: Improves visualization types Signed-off-by: Ashwin Pc <[email protected]> * chore: Updates Render type for other viz expressions Signed-off-by: Ashwin Pc <[email protected]>
Description
Changes in this PR:
ReactExpressionRenderer
throws an error that uiState cannot be changed for a Visualization. This mitigates that by persisting the uiState forReactExpressionRenderer
for the playground.Issues Resolved
Check List
yarn test:jest
yarn test:jest_integration
yarn test:ftr