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

Kibana (8.16.0) does not consistently render Vega grammar with colours #205711

Closed
Vince-dS opened this issue Jan 7, 2025 · 4 comments · Fixed by #208858
Closed

Kibana (8.16.0) does not consistently render Vega grammar with colours #205711

Vince-dS opened this issue Jan 7, 2025 · 4 comments · Fixed by #208858
Assignees
Labels
bug Fixes for quality problems that affect the customer experience Feature:Vega Vega visualizations Team:SharedUX Team label for AppEx-SharedUX (formerly Global Experience) Team:Visualizations Visualization editors, elastic-charts and infrastructure v8.16.0

Comments

@Vince-dS
Copy link

Vince-dS commented Jan 7, 2025

Kibana version: 8.16.0

Elasticsearch version: 8.16.0

Server OS version: on Elastic Cloud

Browser version: Chrome Version 131.0.6778.205 (Official Build) (arm64)

Browser OS version: Mac OS 15.2

Original install method (e.g. download page, yum, from source, etc.):

Describe the bug: copy/paste Vega-lite grammar does not render the code in colours as it use to.

Steps to reproduce:

  1. Dashboard > Add Custom Viz > already the default Vega code is in black not with colours.
  2. copy/paste sample code (i.e. the snippet from https://vega.github.io/vega-lite/docs/calculate.html )
  3. add the line on the top (after opening { for instance ):

"$schema": "https://vega.github.io/schema/vega-lite/v5.json",

  1. vega-lite code stays in black. Sometimes, after few edits, colours are showing up.

Expected behavior:

Screenshots (if relevant):
Image

Errors in browser console (if relevant):

Provide logs and/or server output (if relevant):

Any additional context:

@Vince-dS Vince-dS added bug Fixes for quality problems that affect the customer experience Team:Visualizations Visualization editors, elastic-charts and infrastructure v8.16.0 labels Jan 7, 2025
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-visualizations (Team:Visualizations)

@Vince-dS Vince-dS changed the title Kibana does not consistently render Vega grammar with colours Kibana (8.16.0) does not consistently render Vega grammar with colours Jan 7, 2025
@markov00 markov00 added the Feature:Vega Vega visualizations label Jan 7, 2025
@markov00
Copy link
Member

markov00 commented Jan 10, 2025

I can't reproduce that in main so probably got fixed in the mean time. I'm going to look how that was fixed and try to see if we can backport it to a patch release.
Saw that 8.17 has the same issue

@eokoneyo
Copy link
Contributor

eokoneyo commented Jan 14, 2025

Took a look at this, it's interesting it seems this issue only happens on cloud as I attempted reproducing it the same version in stateful Kibana and I wasn't able to. Adding sharedUX tag so this can be triaged.

@eokoneyo eokoneyo added the Team:SharedUX Team label for AppEx-SharedUX (formerly Global Experience) label Jan 14, 2025
@elasticmachine
Copy link
Contributor

Pinging @elastic/appex-sharedux (Team:SharedUX)

@eokoneyo eokoneyo self-assigned this Jan 20, 2025
@markov00 markov00 self-assigned this Jan 29, 2025
kibanamachine pushed a commit to kibanamachine/kibana that referenced this issue Feb 3, 2025
## Summary

This PR fixes the missing highlight theme for HJSON specs in Vega.
The issue elastic#205711 was caused by
elastic#182348 that inadvertently
specified the code-editor package as sideEffect free. This cause the
compiler to exclude every import without exported and used methods.
This was the case for the code-editor that registered some language
highlighters in that way.

The solution adopted here is to mark the register_language.ts file as a
file with side effects, the alternative solution can be to register
these directly from within the code_editor component.
A third option is to move these registration within the monaco package
where other languages are also registered.
I'd like to leave to @elastic/appex-sharedux the preference to followup
with a better fix for the future.

I'd also like to have the opinion from @elastic/kibana-operations
because the misconfigured package issue can be seen only in production
and not in development mode. Is it possible that webpack doesn't apply
treeshaking when in development mode?

fix elastic#205711
Should also fix the same issue but for TSVB Markdown

The fix was tested on CI by running at first only the CI FT with the
`sideEffects:false` to verify the failure (see
[build](https://buildkite.com/elastic/kibana-pull-request/builds/272375))
and then with the fix specifying the actual file that contains side
effects.

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
(cherry picked from commit 7260564)
kibanamachine pushed a commit to kibanamachine/kibana that referenced this issue Feb 3, 2025
## Summary

This PR fixes the missing highlight theme for HJSON specs in Vega.
The issue elastic#205711 was caused by
elastic#182348 that inadvertently
specified the code-editor package as sideEffect free. This cause the
compiler to exclude every import without exported and used methods.
This was the case for the code-editor that registered some language
highlighters in that way.

The solution adopted here is to mark the register_language.ts file as a
file with side effects, the alternative solution can be to register
these directly from within the code_editor component.
A third option is to move these registration within the monaco package
where other languages are also registered.
I'd like to leave to @elastic/appex-sharedux the preference to followup
with a better fix for the future.

I'd also like to have the opinion from @elastic/kibana-operations
because the misconfigured package issue can be seen only in production
and not in development mode. Is it possible that webpack doesn't apply
treeshaking when in development mode?

fix elastic#205711
Should also fix the same issue but for TSVB Markdown

The fix was tested on CI by running at first only the CI FT with the
`sideEffects:false` to verify the failure (see
[build](https://buildkite.com/elastic/kibana-pull-request/builds/272375))
and then with the fix specifying the actual file that contains side
effects.

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
(cherry picked from commit 7260564)
kibanamachine pushed a commit to kibanamachine/kibana that referenced this issue Feb 3, 2025
## Summary

This PR fixes the missing highlight theme for HJSON specs in Vega.
The issue elastic#205711 was caused by
elastic#182348 that inadvertently
specified the code-editor package as sideEffect free. This cause the
compiler to exclude every import without exported and used methods.
This was the case for the code-editor that registered some language
highlighters in that way.

The solution adopted here is to mark the register_language.ts file as a
file with side effects, the alternative solution can be to register
these directly from within the code_editor component.
A third option is to move these registration within the monaco package
where other languages are also registered.
I'd like to leave to @elastic/appex-sharedux the preference to followup
with a better fix for the future.

I'd also like to have the opinion from @elastic/kibana-operations
because the misconfigured package issue can be seen only in production
and not in development mode. Is it possible that webpack doesn't apply
treeshaking when in development mode?

fix elastic#205711
Should also fix the same issue but for TSVB Markdown

The fix was tested on CI by running at first only the CI FT with the
`sideEffects:false` to verify the failure (see
[build](https://buildkite.com/elastic/kibana-pull-request/builds/272375))
and then with the fix specifying the actual file that contains side
effects.

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
(cherry picked from commit 7260564)
kibanamachine pushed a commit to kibanamachine/kibana that referenced this issue Feb 3, 2025
## Summary

This PR fixes the missing highlight theme for HJSON specs in Vega.
The issue elastic#205711 was caused by
elastic#182348 that inadvertently
specified the code-editor package as sideEffect free. This cause the
compiler to exclude every import without exported and used methods.
This was the case for the code-editor that registered some language
highlighters in that way.

The solution adopted here is to mark the register_language.ts file as a
file with side effects, the alternative solution can be to register
these directly from within the code_editor component.
A third option is to move these registration within the monaco package
where other languages are also registered.
I'd like to leave to @elastic/appex-sharedux the preference to followup
with a better fix for the future.

I'd also like to have the opinion from @elastic/kibana-operations
because the misconfigured package issue can be seen only in production
and not in development mode. Is it possible that webpack doesn't apply
treeshaking when in development mode?

fix elastic#205711
Should also fix the same issue but for TSVB Markdown

The fix was tested on CI by running at first only the CI FT with the
`sideEffects:false` to verify the failure (see
[build](https://buildkite.com/elastic/kibana-pull-request/builds/272375))
and then with the fix specifying the actual file that contains side
effects.

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
(cherry picked from commit 7260564)
kibanamachine added a commit that referenced this issue Feb 3, 2025
# Backport

This will backport the following commits from `main` to `8.18`:
- [[Vega] Fix highlight for HJSON
(#208858)](#208858)

<!--- Backport version: 9.4.3 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)

<!--BACKPORT [{"author":{"name":"Marco
Vettorello","email":"marco.vettorello@elastic.co"},"sourceCommit":{"committedDate":"2025-02-03T13:18:35Z","message":"[Vega]
Fix highlight for HJSON (#208858)\n\n## Summary\r\n\r\nThis PR fixes the
missing highlight theme for HJSON specs in Vega.\r\nThe issue
#205711 was caused
by\r\nhttps://github.com//pull/182348 that
inadvertently\r\nspecified the code-editor package as sideEffect free.
This cause the\r\ncompiler to exclude every import without exported and
used methods.\r\nThis was the case for the code-editor that registered
some language\r\nhighlighters in that way.\r\n\r\nThe solution adopted
here is to mark the register_language.ts file as a\r\nfile with side
effects, the alternative solution can be to register\r\nthese directly
from within the code_editor component.\r\nA third option is to move
these registration within the monaco package\r\nwhere other languages
are also registered.\r\nI'd like to leave to @elastic/appex-sharedux the
preference to followup\r\nwith a better fix for the future.\r\n\r\nI'd
also like to have the opinion from @elastic/kibana-operations\r\nbecause
the misconfigured package issue can be seen only in production\r\nand
not in development mode. Is it possible that webpack doesn't
apply\r\ntreeshaking when in development mode?\r\n\r\nfix
https://github.com/elastic/kibana/issues/205711\r\nShould also fix the
same issue but for TSVB Markdown\r\n\r\nThe fix was tested on CI by
running at first only the CI FT with the\r\n`sideEffects:false` to
verify the failure
(see\r\n[build](https://buildkite.com/elastic/kibana-pull-request/builds/272375))\r\nand
then with the fix specifying the actual file that contains
side\r\neffects.\r\n\r\n---------\r\n\r\nCo-authored-by: kibanamachine
<42973632+kibanamachine@users.noreply.github.com>","sha":"7260564f6a9cd7da71a80e9bd57d836a0bea57c4","branchLabelMapping":{"^v9.1.0$":"main","^v8.19.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["Feature:TSVB","release_note:fix","Feature:Vega","Team:Visualizations","backport:prev-major","v9.1.0"],"title":"[Vega]
Fix highlight for
HJSON","number":208858,"url":"https://github.com/elastic/kibana/pull/208858","mergeCommit":{"message":"[Vega]
Fix highlight for HJSON (#208858)\n\n## Summary\r\n\r\nThis PR fixes the
missing highlight theme for HJSON specs in Vega.\r\nThe issue
#205711 was caused
by\r\nhttps://github.com//pull/182348 that
inadvertently\r\nspecified the code-editor package as sideEffect free.
This cause the\r\ncompiler to exclude every import without exported and
used methods.\r\nThis was the case for the code-editor that registered
some language\r\nhighlighters in that way.\r\n\r\nThe solution adopted
here is to mark the register_language.ts file as a\r\nfile with side
effects, the alternative solution can be to register\r\nthese directly
from within the code_editor component.\r\nA third option is to move
these registration within the monaco package\r\nwhere other languages
are also registered.\r\nI'd like to leave to @elastic/appex-sharedux the
preference to followup\r\nwith a better fix for the future.\r\n\r\nI'd
also like to have the opinion from @elastic/kibana-operations\r\nbecause
the misconfigured package issue can be seen only in production\r\nand
not in development mode. Is it possible that webpack doesn't
apply\r\ntreeshaking when in development mode?\r\n\r\nfix
https://github.com/elastic/kibana/issues/205711\r\nShould also fix the
same issue but for TSVB Markdown\r\n\r\nThe fix was tested on CI by
running at first only the CI FT with the\r\n`sideEffects:false` to
verify the failure
(see\r\n[build](https://buildkite.com/elastic/kibana-pull-request/builds/272375))\r\nand
then with the fix specifying the actual file that contains
side\r\neffects.\r\n\r\n---------\r\n\r\nCo-authored-by: kibanamachine
<42973632+kibanamachine@users.noreply.github.com>","sha":"7260564f6a9cd7da71a80e9bd57d836a0bea57c4"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v9.1.0","branchLabelMappingKey":"^v9.1.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/208858","number":208858,"mergeCommit":{"message":"[Vega]
Fix highlight for HJSON (#208858)\n\n## Summary\r\n\r\nThis PR fixes the
missing highlight theme for HJSON specs in Vega.\r\nThe issue
#205711 was caused
by\r\nhttps://github.com//pull/182348 that
inadvertently\r\nspecified the code-editor package as sideEffect free.
This cause the\r\ncompiler to exclude every import without exported and
used methods.\r\nThis was the case for the code-editor that registered
some language\r\nhighlighters in that way.\r\n\r\nThe solution adopted
here is to mark the register_language.ts file as a\r\nfile with side
effects, the alternative solution can be to register\r\nthese directly
from within the code_editor component.\r\nA third option is to move
these registration within the monaco package\r\nwhere other languages
are also registered.\r\nI'd like to leave to @elastic/appex-sharedux the
preference to followup\r\nwith a better fix for the future.\r\n\r\nI'd
also like to have the opinion from @elastic/kibana-operations\r\nbecause
the misconfigured package issue can be seen only in production\r\nand
not in development mode. Is it possible that webpack doesn't
apply\r\ntreeshaking when in development mode?\r\n\r\nfix
https://github.com/elastic/kibana/issues/205711\r\nShould also fix the
same issue but for TSVB Markdown\r\n\r\nThe fix was tested on CI by
running at first only the CI FT with the\r\n`sideEffects:false` to
verify the failure
(see\r\n[build](https://buildkite.com/elastic/kibana-pull-request/builds/272375))\r\nand
then with the fix specifying the actual file that contains
side\r\neffects.\r\n\r\n---------\r\n\r\nCo-authored-by: kibanamachine
<42973632+kibanamachine@users.noreply.github.com>","sha":"7260564f6a9cd7da71a80e9bd57d836a0bea57c4"}}]}]
BACKPORT-->

Co-authored-by: Marco Vettorello <marco.vettorello@elastic.co>
kibanamachine added a commit that referenced this issue Feb 3, 2025
# Backport

This will backport the following commits from `main` to `8.17`:
- [[Vega] Fix highlight for HJSON
(#208858)](#208858)

<!--- Backport version: 9.4.3 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)

<!--BACKPORT [{"author":{"name":"Marco
Vettorello","email":"marco.vettorello@elastic.co"},"sourceCommit":{"committedDate":"2025-02-03T13:18:35Z","message":"[Vega]
Fix highlight for HJSON (#208858)\n\n## Summary\r\n\r\nThis PR fixes the
missing highlight theme for HJSON specs in Vega.\r\nThe issue
#205711 was caused
by\r\nhttps://github.com//pull/182348 that
inadvertently\r\nspecified the code-editor package as sideEffect free.
This cause the\r\ncompiler to exclude every import without exported and
used methods.\r\nThis was the case for the code-editor that registered
some language\r\nhighlighters in that way.\r\n\r\nThe solution adopted
here is to mark the register_language.ts file as a\r\nfile with side
effects, the alternative solution can be to register\r\nthese directly
from within the code_editor component.\r\nA third option is to move
these registration within the monaco package\r\nwhere other languages
are also registered.\r\nI'd like to leave to @elastic/appex-sharedux the
preference to followup\r\nwith a better fix for the future.\r\n\r\nI'd
also like to have the opinion from @elastic/kibana-operations\r\nbecause
the misconfigured package issue can be seen only in production\r\nand
not in development mode. Is it possible that webpack doesn't
apply\r\ntreeshaking when in development mode?\r\n\r\nfix
https://github.com/elastic/kibana/issues/205711\r\nShould also fix the
same issue but for TSVB Markdown\r\n\r\nThe fix was tested on CI by
running at first only the CI FT with the\r\n`sideEffects:false` to
verify the failure
(see\r\n[build](https://buildkite.com/elastic/kibana-pull-request/builds/272375))\r\nand
then with the fix specifying the actual file that contains
side\r\neffects.\r\n\r\n---------\r\n\r\nCo-authored-by: kibanamachine
<42973632+kibanamachine@users.noreply.github.com>","sha":"7260564f6a9cd7da71a80e9bd57d836a0bea57c4","branchLabelMapping":{"^v9.1.0$":"main","^v8.19.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["Feature:TSVB","release_note:fix","Feature:Vega","Team:Visualizations","backport:prev-major","v9.1.0"],"title":"[Vega]
Fix highlight for
HJSON","number":208858,"url":"https://github.com/elastic/kibana/pull/208858","mergeCommit":{"message":"[Vega]
Fix highlight for HJSON (#208858)\n\n## Summary\r\n\r\nThis PR fixes the
missing highlight theme for HJSON specs in Vega.\r\nThe issue
#205711 was caused
by\r\nhttps://github.com//pull/182348 that
inadvertently\r\nspecified the code-editor package as sideEffect free.
This cause the\r\ncompiler to exclude every import without exported and
used methods.\r\nThis was the case for the code-editor that registered
some language\r\nhighlighters in that way.\r\n\r\nThe solution adopted
here is to mark the register_language.ts file as a\r\nfile with side
effects, the alternative solution can be to register\r\nthese directly
from within the code_editor component.\r\nA third option is to move
these registration within the monaco package\r\nwhere other languages
are also registered.\r\nI'd like to leave to @elastic/appex-sharedux the
preference to followup\r\nwith a better fix for the future.\r\n\r\nI'd
also like to have the opinion from @elastic/kibana-operations\r\nbecause
the misconfigured package issue can be seen only in production\r\nand
not in development mode. Is it possible that webpack doesn't
apply\r\ntreeshaking when in development mode?\r\n\r\nfix
https://github.com/elastic/kibana/issues/205711\r\nShould also fix the
same issue but for TSVB Markdown\r\n\r\nThe fix was tested on CI by
running at first only the CI FT with the\r\n`sideEffects:false` to
verify the failure
(see\r\n[build](https://buildkite.com/elastic/kibana-pull-request/builds/272375))\r\nand
then with the fix specifying the actual file that contains
side\r\neffects.\r\n\r\n---------\r\n\r\nCo-authored-by: kibanamachine
<42973632+kibanamachine@users.noreply.github.com>","sha":"7260564f6a9cd7da71a80e9bd57d836a0bea57c4"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v9.1.0","branchLabelMappingKey":"^v9.1.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/208858","number":208858,"mergeCommit":{"message":"[Vega]
Fix highlight for HJSON (#208858)\n\n## Summary\r\n\r\nThis PR fixes the
missing highlight theme for HJSON specs in Vega.\r\nThe issue
#205711 was caused
by\r\nhttps://github.com//pull/182348 that
inadvertently\r\nspecified the code-editor package as sideEffect free.
This cause the\r\ncompiler to exclude every import without exported and
used methods.\r\nThis was the case for the code-editor that registered
some language\r\nhighlighters in that way.\r\n\r\nThe solution adopted
here is to mark the register_language.ts file as a\r\nfile with side
effects, the alternative solution can be to register\r\nthese directly
from within the code_editor component.\r\nA third option is to move
these registration within the monaco package\r\nwhere other languages
are also registered.\r\nI'd like to leave to @elastic/appex-sharedux the
preference to followup\r\nwith a better fix for the future.\r\n\r\nI'd
also like to have the opinion from @elastic/kibana-operations\r\nbecause
the misconfigured package issue can be seen only in production\r\nand
not in development mode. Is it possible that webpack doesn't
apply\r\ntreeshaking when in development mode?\r\n\r\nfix
https://github.com/elastic/kibana/issues/205711\r\nShould also fix the
same issue but for TSVB Markdown\r\n\r\nThe fix was tested on CI by
running at first only the CI FT with the\r\n`sideEffects:false` to
verify the failure
(see\r\n[build](https://buildkite.com/elastic/kibana-pull-request/builds/272375))\r\nand
then with the fix specifying the actual file that contains
side\r\neffects.\r\n\r\n---------\r\n\r\nCo-authored-by: kibanamachine
<42973632+kibanamachine@users.noreply.github.com>","sha":"7260564f6a9cd7da71a80e9bd57d836a0bea57c4"}}]}]
BACKPORT-->

Co-authored-by: Marco Vettorello <marco.vettorello@elastic.co>
kibanamachine added a commit that referenced this issue Feb 3, 2025
# Backport

This will backport the following commits from `main` to `8.x`:
- [[Vega] Fix highlight for HJSON
(#208858)](#208858)

<!--- Backport version: 9.4.3 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)

<!--BACKPORT [{"author":{"name":"Marco
Vettorello","email":"marco.vettorello@elastic.co"},"sourceCommit":{"committedDate":"2025-02-03T13:18:35Z","message":"[Vega]
Fix highlight for HJSON (#208858)\n\n## Summary\r\n\r\nThis PR fixes the
missing highlight theme for HJSON specs in Vega.\r\nThe issue
#205711 was caused
by\r\nhttps://github.com//pull/182348 that
inadvertently\r\nspecified the code-editor package as sideEffect free.
This cause the\r\ncompiler to exclude every import without exported and
used methods.\r\nThis was the case for the code-editor that registered
some language\r\nhighlighters in that way.\r\n\r\nThe solution adopted
here is to mark the register_language.ts file as a\r\nfile with side
effects, the alternative solution can be to register\r\nthese directly
from within the code_editor component.\r\nA third option is to move
these registration within the monaco package\r\nwhere other languages
are also registered.\r\nI'd like to leave to @elastic/appex-sharedux the
preference to followup\r\nwith a better fix for the future.\r\n\r\nI'd
also like to have the opinion from @elastic/kibana-operations\r\nbecause
the misconfigured package issue can be seen only in production\r\nand
not in development mode. Is it possible that webpack doesn't
apply\r\ntreeshaking when in development mode?\r\n\r\nfix
https://github.com/elastic/kibana/issues/205711\r\nShould also fix the
same issue but for TSVB Markdown\r\n\r\nThe fix was tested on CI by
running at first only the CI FT with the\r\n`sideEffects:false` to
verify the failure
(see\r\n[build](https://buildkite.com/elastic/kibana-pull-request/builds/272375))\r\nand
then with the fix specifying the actual file that contains
side\r\neffects.\r\n\r\n---------\r\n\r\nCo-authored-by: kibanamachine
<42973632+kibanamachine@users.noreply.github.com>","sha":"7260564f6a9cd7da71a80e9bd57d836a0bea57c4","branchLabelMapping":{"^v9.1.0$":"main","^v8.19.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["Feature:TSVB","release_note:fix","Feature:Vega","Team:Visualizations","backport:prev-major","v9.1.0"],"title":"[Vega]
Fix highlight for
HJSON","number":208858,"url":"https://github.com/elastic/kibana/pull/208858","mergeCommit":{"message":"[Vega]
Fix highlight for HJSON (#208858)\n\n## Summary\r\n\r\nThis PR fixes the
missing highlight theme for HJSON specs in Vega.\r\nThe issue
#205711 was caused
by\r\nhttps://github.com//pull/182348 that
inadvertently\r\nspecified the code-editor package as sideEffect free.
This cause the\r\ncompiler to exclude every import without exported and
used methods.\r\nThis was the case for the code-editor that registered
some language\r\nhighlighters in that way.\r\n\r\nThe solution adopted
here is to mark the register_language.ts file as a\r\nfile with side
effects, the alternative solution can be to register\r\nthese directly
from within the code_editor component.\r\nA third option is to move
these registration within the monaco package\r\nwhere other languages
are also registered.\r\nI'd like to leave to @elastic/appex-sharedux the
preference to followup\r\nwith a better fix for the future.\r\n\r\nI'd
also like to have the opinion from @elastic/kibana-operations\r\nbecause
the misconfigured package issue can be seen only in production\r\nand
not in development mode. Is it possible that webpack doesn't
apply\r\ntreeshaking when in development mode?\r\n\r\nfix
https://github.com/elastic/kibana/issues/205711\r\nShould also fix the
same issue but for TSVB Markdown\r\n\r\nThe fix was tested on CI by
running at first only the CI FT with the\r\n`sideEffects:false` to
verify the failure
(see\r\n[build](https://buildkite.com/elastic/kibana-pull-request/builds/272375))\r\nand
then with the fix specifying the actual file that contains
side\r\neffects.\r\n\r\n---------\r\n\r\nCo-authored-by: kibanamachine
<42973632+kibanamachine@users.noreply.github.com>","sha":"7260564f6a9cd7da71a80e9bd57d836a0bea57c4"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v9.1.0","branchLabelMappingKey":"^v9.1.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/208858","number":208858,"mergeCommit":{"message":"[Vega]
Fix highlight for HJSON (#208858)\n\n## Summary\r\n\r\nThis PR fixes the
missing highlight theme for HJSON specs in Vega.\r\nThe issue
#205711 was caused
by\r\nhttps://github.com//pull/182348 that
inadvertently\r\nspecified the code-editor package as sideEffect free.
This cause the\r\ncompiler to exclude every import without exported and
used methods.\r\nThis was the case for the code-editor that registered
some language\r\nhighlighters in that way.\r\n\r\nThe solution adopted
here is to mark the register_language.ts file as a\r\nfile with side
effects, the alternative solution can be to register\r\nthese directly
from within the code_editor component.\r\nA third option is to move
these registration within the monaco package\r\nwhere other languages
are also registered.\r\nI'd like to leave to @elastic/appex-sharedux the
preference to followup\r\nwith a better fix for the future.\r\n\r\nI'd
also like to have the opinion from @elastic/kibana-operations\r\nbecause
the misconfigured package issue can be seen only in production\r\nand
not in development mode. Is it possible that webpack doesn't
apply\r\ntreeshaking when in development mode?\r\n\r\nfix
https://github.com/elastic/kibana/issues/205711\r\nShould also fix the
same issue but for TSVB Markdown\r\n\r\nThe fix was tested on CI by
running at first only the CI FT with the\r\n`sideEffects:false` to
verify the failure
(see\r\n[build](https://buildkite.com/elastic/kibana-pull-request/builds/272375))\r\nand
then with the fix specifying the actual file that contains
side\r\neffects.\r\n\r\n---------\r\n\r\nCo-authored-by: kibanamachine
<42973632+kibanamachine@users.noreply.github.com>","sha":"7260564f6a9cd7da71a80e9bd57d836a0bea57c4"}}]}]
BACKPORT-->

Co-authored-by: Marco Vettorello <marco.vettorello@elastic.co>
kibanamachine added a commit that referenced this issue Feb 5, 2025
# Backport

This will backport the following commits from `main` to `8.16`:
- [[Vega] Fix highlight for HJSON
(#208858)](#208858)

<!--- Backport version: 9.4.3 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)

<!--BACKPORT [{"author":{"name":"Marco
Vettorello","email":"marco.vettorello@elastic.co"},"sourceCommit":{"committedDate":"2025-02-03T13:18:35Z","message":"[Vega]
Fix highlight for HJSON (#208858)\n\n## Summary\r\n\r\nThis PR fixes the
missing highlight theme for HJSON specs in Vega.\r\nThe issue
#205711 was caused
by\r\nhttps://github.com//pull/182348 that
inadvertently\r\nspecified the code-editor package as sideEffect free.
This cause the\r\ncompiler to exclude every import without exported and
used methods.\r\nThis was the case for the code-editor that registered
some language\r\nhighlighters in that way.\r\n\r\nThe solution adopted
here is to mark the register_language.ts file as a\r\nfile with side
effects, the alternative solution can be to register\r\nthese directly
from within the code_editor component.\r\nA third option is to move
these registration within the monaco package\r\nwhere other languages
are also registered.\r\nI'd like to leave to @elastic/appex-sharedux the
preference to followup\r\nwith a better fix for the future.\r\n\r\nI'd
also like to have the opinion from @elastic/kibana-operations\r\nbecause
the misconfigured package issue can be seen only in production\r\nand
not in development mode. Is it possible that webpack doesn't
apply\r\ntreeshaking when in development mode?\r\n\r\nfix
https://github.com/elastic/kibana/issues/205711\r\nShould also fix the
same issue but for TSVB Markdown\r\n\r\nThe fix was tested on CI by
running at first only the CI FT with the\r\n`sideEffects:false` to
verify the failure
(see\r\n[build](https://buildkite.com/elastic/kibana-pull-request/builds/272375))\r\nand
then with the fix specifying the actual file that contains
side\r\neffects.\r\n\r\n---------\r\n\r\nCo-authored-by: kibanamachine
<42973632+kibanamachine@users.noreply.github.com>","sha":"7260564f6a9cd7da71a80e9bd57d836a0bea57c4","branchLabelMapping":{"^v9.1.0$":"main","^v8.19.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["Feature:TSVB","release_note:fix","Feature:Vega","Team:Visualizations","backport:prev-major","v9.1.0"],"title":"[Vega]
Fix highlight for
HJSON","number":208858,"url":"https://github.com/elastic/kibana/pull/208858","mergeCommit":{"message":"[Vega]
Fix highlight for HJSON (#208858)\n\n## Summary\r\n\r\nThis PR fixes the
missing highlight theme for HJSON specs in Vega.\r\nThe issue
#205711 was caused
by\r\nhttps://github.com//pull/182348 that
inadvertently\r\nspecified the code-editor package as sideEffect free.
This cause the\r\ncompiler to exclude every import without exported and
used methods.\r\nThis was the case for the code-editor that registered
some language\r\nhighlighters in that way.\r\n\r\nThe solution adopted
here is to mark the register_language.ts file as a\r\nfile with side
effects, the alternative solution can be to register\r\nthese directly
from within the code_editor component.\r\nA third option is to move
these registration within the monaco package\r\nwhere other languages
are also registered.\r\nI'd like to leave to @elastic/appex-sharedux the
preference to followup\r\nwith a better fix for the future.\r\n\r\nI'd
also like to have the opinion from @elastic/kibana-operations\r\nbecause
the misconfigured package issue can be seen only in production\r\nand
not in development mode. Is it possible that webpack doesn't
apply\r\ntreeshaking when in development mode?\r\n\r\nfix
https://github.com/elastic/kibana/issues/205711\r\nShould also fix the
same issue but for TSVB Markdown\r\n\r\nThe fix was tested on CI by
running at first only the CI FT with the\r\n`sideEffects:false` to
verify the failure
(see\r\n[build](https://buildkite.com/elastic/kibana-pull-request/builds/272375))\r\nand
then with the fix specifying the actual file that contains
side\r\neffects.\r\n\r\n---------\r\n\r\nCo-authored-by: kibanamachine
<42973632+kibanamachine@users.noreply.github.com>","sha":"7260564f6a9cd7da71a80e9bd57d836a0bea57c4"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v9.1.0","branchLabelMappingKey":"^v9.1.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/208858","number":208858,"mergeCommit":{"message":"[Vega]
Fix highlight for HJSON (#208858)\n\n## Summary\r\n\r\nThis PR fixes the
missing highlight theme for HJSON specs in Vega.\r\nThe issue
#205711 was caused
by\r\nhttps://github.com//pull/182348 that
inadvertently\r\nspecified the code-editor package as sideEffect free.
This cause the\r\ncompiler to exclude every import without exported and
used methods.\r\nThis was the case for the code-editor that registered
some language\r\nhighlighters in that way.\r\n\r\nThe solution adopted
here is to mark the register_language.ts file as a\r\nfile with side
effects, the alternative solution can be to register\r\nthese directly
from within the code_editor component.\r\nA third option is to move
these registration within the monaco package\r\nwhere other languages
are also registered.\r\nI'd like to leave to @elastic/appex-sharedux the
preference to followup\r\nwith a better fix for the future.\r\n\r\nI'd
also like to have the opinion from @elastic/kibana-operations\r\nbecause
the misconfigured package issue can be seen only in production\r\nand
not in development mode. Is it possible that webpack doesn't
apply\r\ntreeshaking when in development mode?\r\n\r\nfix
https://github.com/elastic/kibana/issues/205711\r\nShould also fix the
same issue but for TSVB Markdown\r\n\r\nThe fix was tested on CI by
running at first only the CI FT with the\r\n`sideEffects:false` to
verify the failure
(see\r\n[build](https://buildkite.com/elastic/kibana-pull-request/builds/272375))\r\nand
then with the fix specifying the actual file that contains
side\r\neffects.\r\n\r\n---------\r\n\r\nCo-authored-by: kibanamachine
<42973632+kibanamachine@users.noreply.github.com>","sha":"7260564f6a9cd7da71a80e9bd57d836a0bea57c4"}}]}]
BACKPORT-->

Co-authored-by: Marco Vettorello <marco.vettorello@elastic.co>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Fixes for quality problems that affect the customer experience Feature:Vega Vega visualizations Team:SharedUX Team label for AppEx-SharedUX (formerly Global Experience) Team:Visualizations Visualization editors, elastic-charts and infrastructure v8.16.0
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants