You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A regression was caused by the changes in #50182, where some client-side code appeared to be indirectly importing some server-side utilities from the data plugin src/plugins/data/server.
This caused a bunch of additional code to be bundled in the commons.bundle.js, which when executed from IE11, caused a syntax error. (I actually never got to what the specific syntax error was in my investigation, as I was primarily focused on getting rid of the server-side code that was being bundled with everything).
Turns out that some of the Canvas common functions (in this case, saved_map) which are loaded from the browser, are relying on a buildEmbeddableFilters method which is located in the Canvas server lib. This imports some stuff from src/plugins/data/server, which is how the code ended up in the common bundle to begin with.
That said, I believe the changes introduced in #50182 were actually correct: server files should be able to import static code from other server files. The temporary workaround here was to import from src/plugins/data/common, but the real fix is figuring out whether the pieces of buildEmbeddableFilters needed by the client-side code could be split out. I've created #52343 to track this work.
Also cc @elastic/kibana-platform -- If it were possible to have linter rules to catch these sorts of bad imports that inadvertently cross server/client boundaries, it would help eliminate a whole category of bugs we have been seeing during the migration process. Not sure how feasible that would be to implement, but wanted to mention it here.
@lukeelmers as I can see x-pack/legacy/plugins/canvas/server/lib/build_embeddable_filters.ts is supposed to contain server code. It's rather interesting why it's imported from files under the common folder.
You can add this check in eslintrc file
Also cc @elastic/kibana-platform -- If it were possible to have linter rules to catch these sorts of bad imports that inadvertently cross server/client boundaries, it would help eliminate a whole category of bugs we have been seeing during the migration process. Not sure how feasible that would be to implement, but wanted to mention it here.
Just put up a PR here: #52447
We'll have to see how many violations we already have on CI, couldn't get eslint to finish in a reasonable time on my machine.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #50927
A regression was caused by the changes in #50182, where some client-side code appeared to be indirectly importing some server-side utilities from the data plugin
src/plugins/data/server.This caused a bunch of additional code to be bundled in the
commons.bundle.js, which when executed from IE11, caused a syntax error. (I actually never got to what the specific syntax error was in my investigation, as I was primarily focused on getting rid of the server-side code that was being bundled with everything).Turns out that some of the Canvas common functions (in this case,
saved_map) which are loaded from the browser, are relying on abuildEmbeddableFiltersmethod which is located in the Canvas server lib. This imports some stuff fromsrc/plugins/data/server, which is how the code ended up in the common bundle to begin with.That said, I believe the changes introduced in #50182 were actually correct: server files should be able to import static code from other server files. The temporary workaround here was to import from
src/plugins/data/common, but the real fix is figuring out whether the pieces ofbuildEmbeddableFiltersneeded by the client-side code could be split out. I've created #52343 to track this work.