Skip to content

Commit

Permalink
Merge pull request #5388 from jay-hodgson/SWC-6838-499
Browse files Browse the repository at this point in the history
SWC-6838: Cherry pick commits from #5385 for release 499
  • Loading branch information
xschildw authored May 16, 2024
2 parents eb116f6 + 60ac8f8 commit 41813fc
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 8 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
"react-transition-group": "2.6.0",
"sass": "^1.63.6",
"spark-md5": "^3.0.2",
"synapse-react-client": "3.2.16",
"synapse-react-client": "3.2.17",
"universal-cookie": "^4.0.4",
"xss": "^1.0.15"
},
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<webappDirectory>
${project.build.directory}/${project.build.finalName}
</webappDirectory>
<synapse.version>493.0</synapse.version>
<synapse.version>499.0</synapse.version>
<gwtVersion>2.11.0</gwtVersion>
<org.springframework.version>5.3.33</org.springframework.version>
<guiceVersion>3.0</guiceVersion>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,25 @@

import com.google.inject.Inject;
import org.sagebionetworks.web.client.cache.ClientCache;
import org.sagebionetworks.web.client.security.AuthenticationController;

public class WebStorageMaxSizeDetector {

public static final double MAX_SIZE = 4 * ClientProperties.MB; // cleared when approaching ~5MB limit that most browsers implement
public static final int INTERVAL_MS = 1000 * 60 * 5; // check every 5 minutes
ClientCache clientCache;
GWTWrapper gwt;
AuthenticationController authController;

@Inject
public WebStorageMaxSizeDetector(GWTWrapper gwt, ClientCache clientCache) {
public WebStorageMaxSizeDetector(
GWTWrapper gwt,
ClientCache clientCache,
AuthenticationController authController
) {
this.gwt = gwt;
this.clientCache = clientCache;
this.authController = authController;
}

public void start() {
Expand All @@ -40,7 +47,7 @@ private void checkMaxSizeNow() {
);
if (currentSize > MAX_SIZE) {
SynapseJSNIUtilsImpl._consoleLog("Clearing web storage due to the size");
clientCache.clear();
authController.clearLocalStorage();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -84,4 +84,5 @@ void initializeFromExistingAccessTokenCookie(

void checkForUserChange();
void checkForUserChange(Callback cb);
void clearLocalStorage();
}
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5017,10 +5017,10 @@ svg-path-sdf@^1.1.3:
parse-svg-path "^0.1.2"
svg-path-bounds "^1.0.1"

[email protected].16:
version "3.2.16"
resolved "https://registry.yarnpkg.com/synapse-react-client/-/synapse-react-client-3.2.16.tgz#84a6701e9330a6a60d122ebb452b1e1712e57911"
integrity sha512-P3idE3EFb5NnpxgCFD+l4JPEZgT/ZmE2FTzEttpntFRTmOvMS/CymXLDAeoe5/2+wA8p4DSH8MNLahWnROHV5A==
[email protected].17:
version "3.2.17"
resolved "https://registry.yarnpkg.com/synapse-react-client/-/synapse-react-client-3.2.17.tgz#95f1a3d7ccd008bcc4639c05ab1b37cf531621e3"
integrity sha512-stUkfECa89EpCONaQb7oTWtYVBDwmbYH5FPU013ECpUpm8E93L0Co2X7rkxTpIMrE6AwntXhXkcwuANJPbGicg==
dependencies:
"@apidevtools/json-schema-ref-parser" "^9.1.2"
"@brainhubeu/react-carousel" "1.19.26"
Expand Down

0 comments on commit 41813fc

Please sign in to comment.