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

Read MapBox API token at runtime #11889

Merged
merged 6 commits into from
Dec 18, 2024
Merged

Conversation

vitvakatu
Copy link
Contributor

Pull Request Description

Closes #10808

The ENSO_IDE_MAPBOX_API_TOKEN environment variable must be provided at runtime if one wants to use geomap visualization. I also bumped the version of mapbox and implemented async CSS loading in the same way we loaded custom JS for visualizations.

Screenshot 2024-12-17 at 2 34 56 PM

Important Notes

Checklist

Please ensure that the following checklist has been satisfied before submitting the PR:

  • The documentation has been updated, if necessary.
  • Screenshots/screencasts have been attached, if there are any visual changes. For interactive or animated visual changes, a screencast is preferred.
  • All code follows the
    Scala,
    Java,
    TypeScript,
    and
    Rust
    style guides. In case you are using a language not listed above, follow the Rust style guide.
  • Unit tests have been written where possible.
  • If meaningful changes were made to logic or tests affecting Enso Cloud integration in the libraries,
    or the Snowflake database integration, a run of the Extra Tests has been scheduled.
    • If applicable, it is suggested to paste a link to a successful run of the Extra Tests.

Copy link

github-actions bot commented Dec 17, 2024

🧪 Storybook is successfully deployed!

📊 Dashboard:

node.href = url
node.rel = 'stylesheet'
} else if (type === 'scripts') {
assert(node instanceof HTMLScriptElement)
Copy link
Contributor

Choose a reason for hiding this comment

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

This should be a console error and a graceful continue instead of an assert. The visualizations code needs to be treated as user input.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The node here is created a few lines above depending on the type variable, and the assert plays the role of a safe type coercion.

const nodeKind = type === 'scripts' ? 'script' : 'link'
const node = document.createElement(nodeKind)
if (type === 'styles') {
assert(node instanceof HTMLLinkElement)
Copy link
Contributor

Choose a reason for hiding this comment

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

Same here, don't assert in what's effectively a user input parsing code.

@jdunkerley jdunkerley merged commit c2059be into develop Dec 18, 2024
50 checks passed
@jdunkerley jdunkerley deleted the wip/vitvakatu/mapbox-api-token branch December 18, 2024 16:32
jdunkerley pushed a commit that referenced this pull request Dec 18, 2024
* Read mapbox API token at runtime, fix scaling issue

* Load styles the same way as scripts

* remove mapbox dependency

* Update changelog

(cherry picked from commit c2059be)
somebody1234 pushed a commit that referenced this pull request Dec 24, 2024
* Read mapbox API token at runtime, fix scaling issue

* Load styles the same way as scripts

* remove mapbox dependency

* Update changelog
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Fix MapBox token
3 participants