-
Notifications
You must be signed in to change notification settings - Fork 29
Measure page load and shader compile times #8996
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
Changes from all commits
024315c
479937d
09e1398
ead528b
f69203c
f41c6ab
4ce02d5
eb46dae
078f430
01024ff
d3d2444
f8469f7
0e957bf
51814ad
8b4dfad
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -22,7 +22,7 @@ import UrlManager from "viewer/controller/url_manager"; | |
| import ArbitraryController from "viewer/controller/viewmodes/arbitrary_controller"; | ||
| import PlaneController from "viewer/controller/viewmodes/plane_controller"; | ||
| import { AnnotationTool } from "viewer/model/accessors/tool_accessor"; | ||
| import { wkReadyAction } from "viewer/model/actions/actions"; | ||
| import { wkInitializedAction } from "viewer/model/actions/actions"; | ||
| import { redoAction, saveNowAction, undoAction } from "viewer/model/actions/save_actions"; | ||
| import { setViewModeAction, updateLayerSettingAction } from "viewer/model/actions/settings_actions"; | ||
| import { setIsInAnnotationViewAction } from "viewer/model/actions/ui_actions"; | ||
|
|
@@ -42,6 +42,8 @@ type OwnProps = { | |
| type StateProps = { | ||
| viewMode: ViewMode; | ||
| user: APIUser | null | undefined; | ||
| isUiReady: boolean; | ||
| isWkInitialized: boolean; | ||
| }; | ||
| type Props = OwnProps & StateProps; | ||
| type PropsWithRouter = Props & RouteComponentProps & WithBlockerProps; | ||
|
|
@@ -174,14 +176,9 @@ class Controller extends React.PureComponent<PropsWithRouter, State> { | |
| this.initKeyboard(); | ||
| this.initTaskScript(); | ||
| window.webknossos = new ApiLoader(Model); | ||
| app.vent.emit("webknossos:ready"); | ||
| Store.dispatch(wkReadyAction()); | ||
| setTimeout(() => { | ||
| // Give wk (sagas and bucket loading) a bit time to catch air before | ||
| // showing the UI as "ready". The goal here is to avoid that the | ||
| // UI is still freezing after the loading indicator is gone. | ||
| this.props.setControllerStatus("loaded"); | ||
| }, 200); | ||
| app.vent.emit("webknossos:initialized"); | ||
| Store.dispatch(wkInitializedAction()); | ||
| this.props.setControllerStatus("loaded"); | ||
| } | ||
|
|
||
| async initTaskScript() { | ||
|
|
@@ -309,20 +306,22 @@ class Controller extends React.PureComponent<PropsWithRouter, State> { | |
|
|
||
| render() { | ||
| const status = this.props.controllerStatus; | ||
| const { user, viewMode } = this.props; | ||
| const { user, viewMode, isUiReady, isWkInitialized } = this.props; | ||
| const { gotUnhandledError, organizationToSwitchTo } = this.state; | ||
|
|
||
| if (status === "loading") { | ||
| return <BrainSpinner />; | ||
| let cover = null; | ||
| // Show the brain spinner during loading and until the UI is ready | ||
| if (status === "loading" || (status === "loaded" && !isUiReady)) { | ||
philippotto marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| cover = <BrainSpinner />; | ||
| } else if (status === "failedLoading" && user != null) { | ||
| return ( | ||
| cover = ( | ||
| <BrainSpinnerWithError | ||
| gotUnhandledError={gotUnhandledError} | ||
| organizationToSwitchTo={organizationToSwitchTo} | ||
| /> | ||
| ); | ||
| } else if (status === "failedLoading") { | ||
| return ( | ||
|
Comment on lines
-315
to
-325
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Here is the cause for bug noticed here: https://scm.slack.com/archives/C5AKLAV0B/p1761766742395699. The issue seems to be that the status is still loading but wk is already initialized. In that case the previous logic just rendered the brain spinner. The new code now also tries to render the Reverting this code seems to fix the bug. But not sure whether this is actually hiding a bug 🤔 |
||
| cover = ( | ||
| <CoverWithLogin | ||
| onLoggedIn={() => { | ||
| // Close existing error toasts for "Not Found" errors before trying again. | ||
|
|
@@ -334,6 +333,12 @@ class Controller extends React.PureComponent<PropsWithRouter, State> { | |
| ); | ||
| } | ||
|
|
||
| // If wk is not initialized yet, only render the cover. If it is initialized, start rendering the controllers | ||
| // in the background, hidden by the cover. | ||
| if (!isWkInitialized) { | ||
| return cover; | ||
| } | ||
|
|
||
| const { allowedModes } = Store.getState().annotation.restrictions; | ||
|
|
||
| if (!allowedModes.includes(viewMode)) { | ||
|
|
@@ -347,9 +352,19 @@ class Controller extends React.PureComponent<PropsWithRouter, State> { | |
| const isPlane = constants.MODES_PLANE.includes(viewMode); | ||
|
|
||
| if (isArbitrary) { | ||
| return <ArbitraryController viewMode={viewMode} />; | ||
| return ( | ||
| <> | ||
| {cover != null ? cover : null} | ||
| <ArbitraryController viewMode={viewMode} /> | ||
| </> | ||
| ); | ||
| } else if (isPlane) { | ||
| return <PlaneController />; | ||
| return ( | ||
| <> | ||
| {cover != null ? cover : null} | ||
| <PlaneController /> | ||
| </> | ||
| ); | ||
| } else { | ||
| // At the moment, all possible view modes consist of the union of MODES_ARBITRARY and MODES_PLANE | ||
| // In case we add new viewmodes, the following error will be thrown. | ||
|
|
@@ -360,6 +375,8 @@ class Controller extends React.PureComponent<PropsWithRouter, State> { | |
|
|
||
| function mapStateToProps(state: WebknossosState): StateProps { | ||
| return { | ||
| isUiReady: state.uiInformation.isUiReady, | ||
| isWkInitialized: state.uiInformation.isWkInitialized, | ||
| viewMode: state.temporaryConfiguration.viewMode, | ||
| user: state.activeUser, | ||
| }; | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.