-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Import JS API as a module (#1084)
- 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 - We should now look at completing #444 , and get rid of the `embed-grid` and `embed-chart` packages. We can now code-split at the top level. - Enabled proxy in both embed-grid and embed-chart, keeping the loading similar between all three apps - Requires change deephaven/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.
- Loading branch information
Showing
45 changed files
with
1,671 additions
and
1,224 deletions.
There are no files selected for viewing
This file contains 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import React, { useEffect } from 'react'; | ||
import { Provider } from 'react-redux'; | ||
import { MonacoUtils } from '@deephaven/console'; | ||
import { store } from '@deephaven/redux'; | ||
import MonacoWorker from 'monaco-editor/esm/vs/editor/editor.worker?worker'; | ||
import AppRouter from './main/AppRouter'; | ||
import DownloadServiceWorkerUtils from './DownloadServiceWorkerUtils'; | ||
import { unregister } from './serviceWorker'; | ||
|
||
export function AppRoot() { | ||
useEffect(() => { | ||
unregister(); | ||
DownloadServiceWorkerUtils.registerOnLoaded(); | ||
MonacoUtils.init({ getWorker: () => new MonacoWorker() }); | ||
|
||
// disable annoying dnd-react warnings | ||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment | ||
// @ts-ignore | ||
window['__react-beautiful-dnd-disable-dev-warnings'] = true; | ||
}, []); | ||
|
||
return ( | ||
<Provider store={store}> | ||
<AppRouter /> | ||
</Provider> | ||
); | ||
} | ||
|
||
export default AppRoot; |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,25 @@ | ||
import React from 'react'; | ||
import React, { Suspense } from 'react'; | ||
import ReactDOM from 'react-dom'; | ||
import { Provider } from 'react-redux'; | ||
import 'fira'; | ||
import '@deephaven/components/scss/BaseStyleSheet.scss'; | ||
import { MonacoUtils } from '@deephaven/console'; | ||
import { store } from '@deephaven/redux'; | ||
import MonacoWorker from 'monaco-editor/esm/vs/editor/editor.worker?worker'; | ||
import AppRouter from './main/AppRouter'; | ||
import DownloadServiceWorkerUtils from './DownloadServiceWorkerUtils'; | ||
import { LoadingOverlay } from '@deephaven/components'; | ||
import { ApiBootstrap } from '@deephaven/jsapi-bootstrap'; | ||
import logInit from './log/LogInit'; | ||
import { unregister } from './serviceWorker'; | ||
|
||
logInit(); | ||
|
||
const AppRoot = React.lazy(() => import('./AppRoot')); | ||
|
||
ReactDOM.render( | ||
<Provider store={store}> | ||
<AppRouter /> | ||
</Provider>, | ||
<ApiBootstrap | ||
apiUrl={`${import.meta.env.VITE_CORE_API_URL}/${ | ||
import.meta.env.VITE_CORE_API_NAME | ||
}`} | ||
setGlobally | ||
> | ||
<Suspense fallback={<LoadingOverlay />}> | ||
<AppRoot /> | ||
</Suspense> | ||
</ApiBootstrap>, | ||
document.getElementById('root') | ||
); | ||
unregister(); | ||
DownloadServiceWorkerUtils.registerOnLoaded(); | ||
MonacoUtils.init({ getWorker: () => new MonacoWorker() }); | ||
|
||
// disable annoying dnd-react warnings | ||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment | ||
// @ts-ignore | ||
window['__react-beautiful-dnd-disable-dev-warnings'] = true; |
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.