Skip to content

Commit c97391e

Browse files
committed
Pull project restore grace period into a constant
1 parent b4c986d commit c97391e

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

src/clients/localStorage.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
const PROJECT_STORAGE_KEY = 'last-closed-session-project-state';
2+
const GRACE_PERIOD = 5 * 60 * 1000;
23

34
export function dehydrateProject(project) {
45
localStorage.setItem(PROJECT_STORAGE_KEY, JSON.stringify({
@@ -12,7 +13,7 @@ export function rehydrateProject() {
1213
localStorage.removeItem(PROJECT_STORAGE_KEY);
1314
if (dehydrated) {
1415
const rehydrated = JSON.parse(dehydrated);
15-
if (Date.now() - rehydrated.dehydratedAt <= 5 * 60 * 1000) {
16+
if (Date.now() - rehydrated.dehydratedAt <= GRACE_PERIOD) {
1617
return rehydrated.project;
1718
}
1819
}

0 commit comments

Comments
 (0)