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

Custom Javascript editing/parser in deck.gl visualisations seems to be broken #19349

Closed
3 tasks done
Gordonei opened this issue Mar 24, 2022 · 7 comments
Closed
3 tasks done
Labels
#bug Bug report validation:required A committer should validate the issue

Comments

@Gordonei
Copy link

Gordonei commented Mar 24, 2022

Firstly, thanks for such an awesome project!

When trying to add Javascript to customise onClick, Tooltips, etc. in the deck.gl visualisations, the text box in which you enter the code text behaves erratically. It is also unclear what is actually persisted onto the visualisation, it doesn't appear to be the code as entered.

How to reproduce the bug

(I've given instructions for the deck.gl Scatterplot, but seems to apply to all deck.gl visualisations)

  1. Go to Charts, Add new chart
  2. Select a dataset with spatial attributes, choose deck.gl Scatterplot, click on Create New Chart
  3. Configure Chart to display some data (i.e. configure the Lat-Long values)
  4. Under Data configuration pane on left of screen, expand the "Advanced" collapse. Attempt to enter text in the "Javascript Tooltip Generator". It should enter duplicate values.
  5. In the browser console, there should be Uncaught TypeError: (validationErrors || []).forEach is not a function

Expected results

Text typed in the Javascipt fields in deck.gl visualisations to appear as typed. For the code entered to be executed in the context of the visualisation.

Actual results

Text appearing in field does not match what was typed. Custom JS code doesn't appear to be executed in map.

Following error appearing in browser console per character typing:

explore.fd9dbc001a8d2b732fc9.entry.js:624 Uncaught TypeError: (validationErrors || []).forEach is not a function
    at Object.SET_FIELD_VALUE (explore.fd9dbc001a8d2b732fc9.entry.js:624:32)
    at exploreReducer (explore.fd9dbc001a8d2b732fc9.entry.js:694:39)
    at combination (vendors.866d9853ec9ca701f3b8.entry.js:198222:29)
    at dispatch (vendors.866d9853ec9ca701f3b8.entry.js:197988:22)
    at 3236.54993c7b99382ace8b98.entry.js:242:12
    at 1844.8922f8dcb86356245bf9.entry.js:1075:16
    at vendors.866d9853ec9ca701f3b8.entry.js:198240:12
    at Object.onChange (7173.0ceb268407a17642e1ec.entry.js:12551:61)
    at ReactAce.push.93946.ReactAce.onChange (437abb94798b28dd8787.chunk.js:25959:24)
    at Editor.EventEmitter._signal (600b0291f89941e46ffa.chunk.js:3870:21)

Screenshots

This is what appeared after typing a single d character:

image

This is after typing d =>:

image

Environment

  • browser type and version:
    • Mozilla Firefox 98.0 (64-bit)
    • Google Chrome Version 99.0.4844.51 (Official Build) (64-bit)

(built off apache/superset:1.4.0 Docker image tag)

  • superset version: 1.4.0
  • python version: python 3.8.12
  • node.js version: sorry, not sure how to get the node version inside the running docker container?
  • any feature flags active:
    • ENABLE_TEMPLATE_PROCESSING
    • ALERT_REPORTS
    • THUMBNAILS
    • LISTVIEWS_DEFAULT_CARD_VIEW
    • DASHBOARD_NATIVE_FILTERS
    • ENABLE_JAVASCRIPT_CONTROLS (in tooltips config section)

Checklist

Make sure to follow these steps before submitting your issue - thank you!

  • I have checked the superset logs for python stacktraces and included it here as text if there are any.
  • I have reproduced the issue with at least the latest released version of superset.
  • I have checked the issue tracker for the same issue and I haven't found one similar.

Additional context

I'm aware this functionality is fairly old (#4173), so I wonder if maybe a subsequent change has broken the in-browser JS parsing?

@Gordonei Gordonei added the #bug Bug report label Mar 24, 2022
@AAfghahi AAfghahi added the validation:required A committer should validate the issue label Mar 24, 2022
@AAfghahi
Copy link
Member

Hello, did you add anything into the Extra Data column?

@Gordonei
Copy link
Author

Hi @AAfghahi , I did not - let me try quickly

@Gordonei
Copy link
Author

After adding a field to the extra data column, bug behaviour seems the same:

image

Still getting the error in the browser console:

explore.fd9dbc001a8d2b732fc9.entry.js:624 Uncaught TypeError: (validationErrors || []).forEach is not a function
    at Object.SET_FIELD_VALUE (explore.fd9dbc001a8d2b732fc9.entry.js:624:32)
    at exploreReducer (explore.fd9dbc001a8d2b732fc9.entry.js:694:39)
    at combination (vendors.866d9853ec9ca701f3b8.entry.js:198222:29)
    at dispatch (vendors.866d9853ec9ca701f3b8.entry.js:197988:22)
    at 3236.54993c7b99382ace8b98.entry.js:242:12
    at 1844.8922f8dcb86356245bf9.entry.js:1075:16
    at vendors.866d9853ec9ca701f3b8.entry.js:198240:12
    at Object.onChange (7173.0ceb268407a17642e1ec.entry.js:12551:61)
    at ReactAce.push.93946.ReactAce.onChange (437abb94798b28dd8787.chunk.js:25959:24)
    at Editor.EventEmitter._signal (600b0291f89941e46ffa.chunk.js:3870:21)

@stephenLYZ
Copy link
Member

Fixed by #18146

@Gordonei
Copy link
Author

Gordonei commented Apr 7, 2022

thanks, @stephenLYZ, will confirm the fix and close the issue!

@riazarbi
Copy link

riazarbi commented May 3, 2022

This works on v1.5

@Gordonei
Copy link
Author

Confirmed the fix!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
#bug Bug report validation:required A committer should validate the issue
Projects
None yet
Development

No branches or pull requests

4 participants