perf: optimize full interface loading and refresh paths
This commit is contained in:
1 parent
649a0df832
commit
f317314a3c
57 files changed
+791
-136
No files matched your search
@@ -6,7 +6,7 @@ const at='2026-10-27T03:30:00.000Z';
|
||||
function fixture({verifyError,sendError,result,channelId='mail',expired=false}={}){
|
||||
const batch={id:'batch',status:'prepared',cutoff:expired?'2026-10-27T02:00:00.000Z':at,channelId,to:['2639266652@qq.com'],cc:[],attachments:[],orderIds:['order'],ruleSnapshot:{}};
|
||||
const completions=[];let submissions=0,begun=0;
|
||||
const store={get:()=>null,now:()=>at,settings:()=>({enabled:true,channelId:'mail'}),snapshot:()=>({batches:[batch],capabilities:{liveTodo:true,pdfExport:true,automaticArchive:true}}),discoveryBlockers:()=>[],batchIncomplete:()=>false,beginSending:()=>{begun++;},finishSending:(...args)=>completions.push(args)};
|
||||
const store={get:()=>null,now:()=>at,settings:()=>({enabled:true,channelId:'mail'}),all:kind=>kind==='batches'?[structuredClone(batch)]:[],capabilities:{liveTodo:true,pdfExport:true,automaticArchive:true},discoveryBlockers:()=>[],batchIncomplete:()=>false,beginSending:()=>{begun++;},finishSending:(...args)=>completions.push(args)};
|
||||
const mail={store:{channelSecret:()=>({id:'mail',version:1,email:'sender@example.com',smtp:{}}),guard:()=>{}},smtpFactory:()=>({verify:async()=>{if(verifyError)throw verifyError;},sendMail:async()=>{submissions++;if(sendError)throw sendError;return result||{accepted:['2639266652@qq.com'],rejected:[]};},close:()=>{}})};
|
||||
const dispatcher=new OrderRuleDispatcher({store,mail,settings:()=>({}),clock:()=>new Date(at),providersReady:()=>true});
|
||||
return {dispatcher,batch,store,completions,counts:()=>({submissions,begun})};
|
||||
|
||||
Reference in new issue
Block a user