Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"@eslint/js": "^9.0.0",
"@fluentui/react": "^8.122.8",
"@fluentui/react-icons": "^2.0.271",
"@lezer/highlight": "^1.2.3",
"@monaco-editor/loader": "^1.4.0",
"@monaco-editor/react": "^4.6.0",
"@replit/codemirror-emacs": "^6.1.0",
Expand Down Expand Up @@ -67,6 +68,7 @@
"file-saver": "^2.0.5",
"globals": "^15.0.0",
"jsdom": "^25.0.1",
"markdown-it": "^14.1.1",
"monaco-editor": "^0.45.0",
"monaco-vim": "^0.3.4",
"prettier": "^3.2.4",
Expand Down Expand Up @@ -121,5 +123,8 @@
"last 1 firefox version",
"last 1 safari version"
]
},
"devDependencies": {
"@types/markdown-it": "^14"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -191,3 +191,5 @@ export const CodeEditorContainer: React.FC = () => {
/>
)
}

export default CodeEditorContainer
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import React from 'react'

import { Spinner, SpinnerSize } from '@fluentui/react'
import { FlexContainer } from '../FlexContainer'

const styles = {
flex: '1 1 0%',
overflow: 'hidden',
display: 'flex',
'align-items': 'center',
'justify-content': 'center',
}

const CodeEditorContainer = React.lazy(() => import('./CodeEditorContainer'))

const CodeEditorPreloader: React.FC = () => (
<div style={styles}>
<Spinner key="spinner" label="Loading editor..." size={SpinnerSize.large} labelPosition="bottom" />
</div>
)

/**
* Lazy-loading wrapper for code editor container
*/
export const LazyCodeEditorContainer: React.FC = () => {
return (
<React.Suspense fallback={<CodeEditorPreloader />}>
<CodeEditorContainer />
</React.Suspense>
)
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React, { lazy } from 'react'
import { SuspenseBoundary } from '~/components/elements/misc/SuspenseBoundary'

const LazyWorkspace = lazy(async () => await import('./Workspace.tsx'))
const LazyWorkspace = lazy(async () => await import('./Workspace'))

export const LazyLoadedWorkspace: React.FC = () => (
<SuspenseBoundary errorLabel="Failed to load workspace" preloaderText="Loading workspace...">
Expand Down
5 changes: 2 additions & 3 deletions web/src/components/features/workspace/Workspace/Workspace.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@ import { dispatchCreateFile, dispatchRemoveFile, dispatchImportFile, newFileSele
import { TabView } from '~/components/elements/tabs/TabView'
import type { TabBarAction, TabIconStyles } from '~/components/elements/tabs/types'

import { CodeEditorContainer } from '../CMCodeEditor/CodeEditorContainer'
import { FlexContainer } from '../FlexContainer'
import { LazyCodeEditorContainer } from '../CMCodeEditor/LazyCodeEditorContainer'
import { NewFileModal } from '../NewFileModal'
import { ContentPlaceholder } from '../ContentPlaceholder'
import { newEmptyFileContent } from './utils'
Expand Down Expand Up @@ -109,7 +108,7 @@ const Workspace: React.FC = () => {
disabled={(snippet?.loading ?? false) || !!snippet?.error}
>
{tabs?.length ? (
<CodeEditorContainer />
<LazyCodeEditorContainer />
) : (
<ContentPlaceholder
isLoading={snippet?.loading}
Expand Down
1 change: 0 additions & 1 deletion web/src/components/layout/Header/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,6 @@ class HeaderContainer extends ThemeableComponent<Props, HeaderState> {
private onSettingsClose(changes: SettingsChanges) {
if (changes.monaco) {
// Update monaco state if some of its settings were changed
console.log(changes.monaco)
this.props.dispatch(newMonacoParamsChangeDispatcher(changes.monaco))
}

Expand Down
2 changes: 1 addition & 1 deletion web/src/components/pages/PlaygroundPage/PlaygroundPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import styles from './PlaygroundPage.module.css'
import { SuspenseBoundary } from '~/components/elements/misc/SuspenseBoundary'
import { LazyAnnouncementBanner } from '~/components/layout/AnnouncementBanner'

const LazyPlaygroundContent = lazy(async () => await import('./PlaygroundContainer.tsx'))
const LazyPlaygroundContent = lazy(async () => await import('./PlaygroundContainer'))

interface PageParams {
snippetID: string
Expand Down
Loading