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

feat: Import JS API as a module #1084

Merged
merged 8 commits into from
Feb 12, 2023
Merged

Conversation

mofojed
Copy link
Member

@mofojed mofojed commented Feb 10, 2023

  • Pulled the types out of jsapi-shim into a separate pacakge jsapi-types
    • Now other packages can import just the types without the shim possibly failing because the API isn't loaded yet
    • Will be deprecated/replaced with the automatically published TS definitions when @niloc132 has finished that
  • Added jsapi-bootstrap package to load the API and display an error if it can't load
    • Can set the API globally, or use it from a React context object
    • Displays an error if the API cannot be loaded
  • Use code-splitting to bootstrap the API globally to keep existing code running until we port everything over
  • Enabled proxy in both embed-grid and embed-chart, keeping the loading similar between all three apps
  • Requires change Update DeepHavenJsApiLinker to allow exporting GWT JsTypes as ES6 module deephaven-core#2733

Breaking Change: The JS API packaged as a module is now required for the code-studio, embed-grid, and embed-chart applications. Existing (Enterprise) applications should be able to use jsapi-shim still and load the JS API using the old method.

- Doesn't change jsapi-shim at all
@codecov
Copy link

codecov bot commented Feb 10, 2023

Codecov Report

Merging #1084 (fcfc034) into main (eafe052) will increase coverage by 0.80%.
The diff coverage is 0.00%.

@@            Coverage Diff             @@
##             main    #1084      +/-   ##
==========================================
+ Coverage   42.10%   42.91%   +0.80%     
==========================================
  Files         432      434       +2     
  Lines       32555    32593      +38     
  Branches     8191     8198       +7     
==========================================
+ Hits        13707    13987     +280     
+ Misses      18795    18557     -238     
+ Partials       53       49       -4     
Flag Coverage Δ
unit 42.91% <0.00%> (+0.80%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
packages/code-studio/src/AppRoot.tsx 0.00% <0.00%> (ø)
packages/code-studio/src/index.tsx 0.00% <0.00%> (ø)
packages/components/src/LoadingOverlay.tsx 0.00% <ø> (ø)
...shboard-core-plugins/src/panels/MockFileStorage.ts 14.81% <0.00%> (-10.19%) ⬇️
packages/file-explorer/src/FileTestUtils.ts 100.00% <0.00%> (ø)
packages/file-explorer/src/NewItemModal.tsx 1.52% <0.00%> (+1.52%) ⬆️
packages/file-explorer/src/FileUtils.ts 88.17% <0.00%> (+5.37%) ⬆️
packages/file-explorer/src/FileList.tsx 57.07% <0.00%> (+47.78%) ⬆️
packages/file-explorer/src/FileExplorer.tsx 80.24% <0.00%> (+80.24%) ⬆️
packages/file-explorer/src/FileListContainer.tsx 98.50% <0.00%> (+98.50%) ⬆️
... and 3 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@mofojed mofojed mentioned this pull request Feb 10, 2023
- Shows an error message if it doesn't load properly
- Takes a child component that gets shown when loaded
- Uses code-splitting to only load the app after the API has successfully loaded
- Can now be used by all the different apps (code-studio, embed-grid, embed-chart)
- Could update the error shown to use some of our fancier components (uses modal)
- Separate JS API types into their own package - now you can use the types without importing jsapi-shim
- Needed to set up proxies for both
@mofojed mofojed changed the title Import JS API as a module, bootstrap it in feat: Import JS API as a module Feb 10, 2023
- Nothing has been changed there yet, not even published
@mofojed mofojed self-assigned this Feb 10, 2023
@mofojed mofojed added this to the February 2023 milestone Feb 10, 2023
@mofojed mofojed marked this pull request as ready for review February 10, 2023 16:49
@mofojed mofojed requested a review from vbabich February 10, 2023 16:49
vbabich
vbabich previously approved these changes Feb 10, 2023
vbabich
vbabich previously approved these changes Feb 10, 2023
mattrunyon
mattrunyon previously approved these changes Feb 10, 2023
packages/code-studio/src/index.tsx Show resolved Hide resolved
- We were building with the full API URL, which was failing to load because of CORS now that we're loading it dynamically
- Need to pass the proxy in to the webServer command in playwright, or else it will not load correctly
@mofojed mofojed merged commit 9aab657 into deephaven:main Feb 12, 2023
@mofojed mofojed deleted the jsapi-core-module-4 branch February 12, 2023 13:39
@github-actions github-actions bot locked and limited conversation to collaborators Feb 12, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants