-
Notifications
You must be signed in to change notification settings - Fork 40
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
SWC-7126 - Fix bootstrapping redirect bug #5560
Changes from all commits
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 |
---|---|---|
|
@@ -18,6 +18,7 @@ | |
import com.google.gwt.user.client.ui.RootPanel; | ||
import com.google.gwt.user.client.ui.SimplePanel; | ||
import java.util.HashMap; | ||
import java.util.function.Consumer; | ||
import org.sagebionetworks.schema.adapter.JSONObjectAdapter; | ||
import org.sagebionetworks.web.client.mvp.AppActivityMapper; | ||
import org.sagebionetworks.web.client.mvp.AppPlaceHistoryMapper; | ||
|
@@ -92,16 +93,12 @@ public void onSuccess() { | |
ginjector | ||
.getSynapseProperties() | ||
.getInitSynapsePropertiesFuture(); | ||
FluentFuture<Void> checkForUserChangeFuture = ginjector | ||
.getAuthenticationController() | ||
.getCheckForUserChangeFuture(); | ||
|
||
FluentFuture | ||
.from( | ||
whenAllComplete( | ||
featureFlagConfigFuture, | ||
synapsePropertiesFuture, | ||
checkForUserChangeFuture | ||
synapsePropertiesFuture | ||
) | ||
.call( | ||
() -> { | ||
|
@@ -170,38 +167,67 @@ public void onSuccess() { | |
globalApplicationState.setAppPlaceHistoryMapper( | ||
historyMapper | ||
); | ||
globalApplicationState.init( | ||
new Callback() { | ||
@Override | ||
public void invoke() { | ||
// listen for window close (or navigating away) | ||
registerWindowClosingHandler( | ||
globalApplicationState | ||
); | ||
registerOnPopStateHandler(globalApplicationState); | ||
|
||
// start version timer | ||
ginjector.getVersionTimer().start(); | ||
// start timer to check for Synapse outage or scheduled maintenance | ||
ginjector.getSynapseStatusDetector().start(); | ||
// Goes to place represented on URL or default place | ||
historyHandler.handleCurrentHistory(); | ||
globalApplicationState.initializeDropZone(); | ||
globalApplicationState.initializeToastContainer(); | ||
// initialize the view default columns so that they're ready when we need them (do this by constructing that singleton object) | ||
ginjector.getViewDefaultColumns(); | ||
FluentFuture | ||
.from( | ||
whenAllComplete( | ||
// Checking the session may result in a redirect, so this must be invoked after `setPlaceController` | ||
ginjector | ||
.getAuthenticationController() | ||
.getCheckForUserChangeFuture() | ||
) | ||
Comment on lines
+173
to
+178
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. using this |
||
.call( | ||
() -> { | ||
globalApplicationState.init( | ||
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. Finally, call |
||
new Callback() { | ||
@Override | ||
public void invoke() { | ||
// listen for window close (or navigating away) | ||
registerWindowClosingHandler( | ||
globalApplicationState | ||
); | ||
registerOnPopStateHandler( | ||
globalApplicationState | ||
); | ||
|
||
// start timer to check for user session state change (session expired, or user explicitly logged | ||
// out). Backend endpoints must be set before starting this (because it attempts to get "my user profile") | ||
ginjector.getSessionDetector().start(); | ||
// start version timer | ||
ginjector.getVersionTimer().start(); | ||
// start timer to check for Synapse outage or scheduled maintenance | ||
ginjector | ||
.getSynapseStatusDetector() | ||
.start(); | ||
// Goes to place represented on URL or default place | ||
historyHandler.handleCurrentHistory(); | ||
globalApplicationState.initializeDropZone(); | ||
globalApplicationState.initializeToastContainer(); | ||
// initialize the view default columns so that they're ready when we need them (do this by constructing that singleton object) | ||
ginjector.getViewDefaultColumns(); | ||
|
||
// start a timer to check to see if we're approaching the max allowable space in the web storage. | ||
// clears out the web storage (cache) if this is the case. | ||
ginjector.getWebStorageMaxSizeDetector().start(); | ||
} | ||
} | ||
); | ||
// start timer to check for user session state change (session expired, or user explicitly logged | ||
// out). Backend endpoints must be set before starting this (because it attempts to get "my user profile") | ||
ginjector.getSessionDetector().start(); | ||
|
||
// start a timer to check to see if we're approaching the max allowable space in the web storage. | ||
// clears out the web storage (cache) if this is the case. | ||
ginjector | ||
.getWebStorageMaxSizeDetector() | ||
.start(); | ||
} | ||
} | ||
); | ||
return null; | ||
}, | ||
directExecutor() | ||
) | ||
) | ||
.catching( | ||
Throwable.class, | ||
e -> { | ||
onFailure(e); | ||
return null; | ||
}, | ||
directExecutor() | ||
); | ||
return null; | ||
}, | ||
directExecutor() | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We have a dependency cycle where
AuthenticationControllerImpl.checkForUserChangeFuture
may try to callGlobalApplicationStateImpl.goTo
, butGlobalApplicationStateImpl.goTo
relies on thePlaceController
, which is not ready; it is initialized and set in this future's callback (on line 167 (old) / 164 (new).We'll run the first two futures, but defer running
checkForUserChangeFuture
until theplaceController
is set