Skip to content
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

[blockly] Fix missing event property causes JS error #2476

Merged
merged 3 commits into from Mar 24, 2024

Conversation

stefan-hoehn
Copy link
Contributor

@stefan-hoehn stefan-hoehn commented Mar 13, 2024

see https://community.openhab.org/t/blockly-proposal-to-change-contextual-info-blocks/154403/27

image
if (event.itemState?.toString() != undefined) {
  console.info('Event IS defined');
} else {
  console.info('Event isn\'t defined');
}
if (event.itemState !== undefined ? parseFloat(event.itemState.toString()) : undefined != undefined) {
  console.info('Event IS defined');
} else {
  console.info('Event isn\'t defined');
}
if (event.itemState !== undefined ? Quantity(event.itemState.toString() : undefined) != undefined) {
  console.info('Event IS defined');
} else {
  console.info('Event isn\'t defined');
}

Signed-off-by: Stefan Höhn <mail@stefanhoehn.com>
@stefan-hoehn stefan-hoehn requested a review from a team as a code owner March 13, 2024 19:52
Copy link

relativeci bot commented Mar 13, 2024

Job #1837: Bundle Size — 10.55MiB (~+0.01%).

7c79397(current) vs 1bebae3 main#1833(baseline)

Warning

Bundle contains 2 duplicate packages – View duplicate packages

Bundle metrics  Change 1 change
                 Current
Job #1837
     Baseline
Job #1833
No change  Initial JS 1.86MiB 1.86MiB
No change  Initial CSS 607.87KiB 607.87KiB
Change  Cache Invalidation 17.97% 18.31%
No change  Chunks 223 223
No change  Assets 246 246
No change  Modules 2857 2857
No change  Duplicate Modules 141 141
No change  Duplicate Code 1.73% 1.73%
No change  Packages 94 94
No change  Duplicate Packages 2 2
Bundle size by type  Change 1 change Regression 1 regression
                 Current
Job #1837
     Baseline
Job #1833
Regression  JS 8.74MiB (~+0.01%) 8.74MiB
Not changed  CSS 890.03KiB 890.03KiB
Not changed  Fonts 526.1KiB 526.1KiB
Not changed  Media 295.6KiB 295.6KiB
Not changed  IMG 140.74KiB 140.74KiB
Not changed  HTML 1.24KiB 1.24KiB
Not changed  Other 871B 871B

View job #1837 reportView stefan-hoehn:blockly_eventcontex... branch activityView project dashboard

Copy link
Contributor

@florian-h05 florian-h05 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please have a look at my comments.

@florian-h05 florian-h05 added enhancement New feature or request main ui Main UI labels Mar 18, 2024
Copy link
Contributor

@florian-h05 florian-h05 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks!

@florian-h05 florian-h05 added this to the 4.2 milestone Mar 24, 2024
@florian-h05 florian-h05 changed the title Optional chaining for event-context block [blockly] Fix missing event property causes JS error Mar 24, 2024
@florian-h05 florian-h05 added bug Something isn't working and removed enhancement New feature or request labels Mar 24, 2024
@florian-h05 florian-h05 merged commit 32b8b88 into openhab:main Mar 24, 2024
6 checks passed
@florian-h05 florian-h05 deleted the blockly_eventcontext_undefined branch March 24, 2024 20:26
florian-h05 pushed a commit that referenced this pull request Mar 24, 2024
@florian-h05 florian-h05 added the patch A PR that has been cherry-picked to a patch release branch label Mar 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working main ui Main UI patch A PR that has been cherry-picked to a patch release branch
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants