fix: serialize Week-to-Today replay across tabs
This commit is contained in:
1 parent
c03d0a091f
commit
4a6a829401
3 files changed
+43
-4
No files matched your search
@@ -391,7 +391,7 @@
|
||||
});
|
||||
const weekPlan = createWeekPlan({
|
||||
fetchJson:fetchReviewJson,localDate:todayRollover.localDate,timeZone:todayRollover.timeZone,
|
||||
storage:localStorage,getLogin:() => planningOwnerLogin,
|
||||
storage:localStorage,getLogin:() => planningOwnerLogin,coordinator:outboxCoordinator,
|
||||
});
|
||||
function openWeekPlanner(trigger) { planningTomorrow=false; return weekFlow.open(trigger); }
|
||||
function renderTomorrowQueueSummary(value) {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
function createWeekPlan({fetchJson,localDate,timeZone,storage,getLogin,now=()=>Date.now()}={}) {
|
||||
function createWeekPlan({fetchJson,localDate,timeZone,storage,getLogin,coordinator,now=()=>Date.now()}={}) {
|
||||
let week={revision:0,timezone:null,days:[]};
|
||||
let flushing=null;
|
||||
let lastConflict=null;
|
||||
@@ -530,7 +530,7 @@ function createWeekPlan({fetchJson,localDate,timeZone,storage,getLogin,now=()=>D
|
||||
function flushPull() {
|
||||
if(pulling)return pulling;
|
||||
if(!pendingPull()||!pullKey())return Promise.resolve(false);
|
||||
pulling=(async()=>{
|
||||
const run=async()=>{
|
||||
let result,lastResult=false;
|
||||
while(pendingPull()){
|
||||
const current=pendingPull();
|
||||
@@ -564,7 +564,9 @@ function createWeekPlan({fetchJson,localDate,timeZone,storage,getLogin,now=()=>D
|
||||
}
|
||||
adoptConfirmed(lastResult.week,{...confirmedItems,...pendingItems});
|
||||
return {...lastResult,sync_pending:false};
|
||||
})().finally(()=>{pulling=null;});
|
||||
};
|
||||
const delivery=coordinator?coordinator.runExclusive('week',run):run();
|
||||
pulling=Promise.resolve(delivery).finally(()=>{pulling=null;});
|
||||
return pulling;
|
||||
}
|
||||
async function startEarly(planDate,todayRevision) {
|
||||
|
||||
Reference in new issue
Block a user