Skip to content

Commit

Permalink
fix to ensure props are available before testing them
Browse files Browse the repository at this point in the history
  • Loading branch information
srclosson committed Sep 22, 2023
1 parent 0189f25 commit 35b171c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "grafana-div-panel",
"version": "1.2.0",
"version": "1.2.1",
"description": "Create your own panel with html + css and javascript",
"scripts": {
"build": "webpack -c ./.config/webpack/webpack.config.ts --env production",
Expand Down
3 changes: 2 additions & 1 deletion src/divPanelChild.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ export class DivPanelChild extends Component<DivPanelChildProps, State> {

shouldComponentUpdate = (prevProps: DivPanelChildProps, prevState: State): boolean => {
const truth =
JSON.stringify(prevProps) !== JSON.stringify(this.props) ||
((typeof prevProps !== "undefined" && typeof this.props !== "undefined) &&
(JSON.stringify(prevProps) !== JSON.stringify(this.props))) ||
prevProps.data.state === 'Done' ||
prevProps.data.state === 'Streaming';
return truth;
Expand Down

0 comments on commit 35b171c

Please sign in to comment.