hamedpro / freeflow-core

🩵⚡️next generation of decentralised collaboration
3 stars 1 forks source link

time machine func #161

Closed hamedpro closed 1 year ago

hamedpro commented 1 year ago

after user auth, he/she has to subscribe to changes by sending a transaction range (start_id , end_id ), we send back these :

what is initial_values : for each unique thing_id in transactions it includes the value that the first tr of that thing must be patched to that. if user wants just third to 10th transactions of something initial value is equal to diffs of those first 2 trs applied to undefined.

hamedpro commented 1 year ago

the system changed : we have a type 'transactions_pack':

{
filtered_for : user_id[],
ranges : [number | undef , number | undef] [],
all_transactions : tr[],
discoverable_transactions : thing_id[] []
}

at the sub time you send an object containing these 2 props of saved transactions_pack :

{filtered_for , ranges } 

and server starts sending back diffs of transactions_pack s. each time you get a diff apply it inside the memory then try if that fits into LocalStorage. if it does its ok but if it doesn't, let user know it will not be written into LocalStorage. at this points user must choose this button or dismiss : "select smaller time travel ranges"

hamedpro commented 1 year ago

the progress will be tracked in #197