Skip to content

Latest commit

 

History

History
37 lines (27 loc) · 1.19 KB

README.md

File metadata and controls

37 lines (27 loc) · 1.19 KB

parallel fetching

usually there are fetching (async await) it does that in a waterfall manner means like a step(stair). one is finish then other is started (good when next is depend on prev) but if the both function are independent we can do that in parallel saving the runtime. so we use Promise.all

const[data1,data2]=Promise.all([getdata1(),getdata2()]) here if one get wrong all are mark wrong

const[data1,data2]=Promise.allSettled([getdata1(),getdata2()]) but settled makes only the one wrong, wrong.

server action can also be done in client

demo serveraction

normal server action in server component

server demo

button has type="submit"

serveractionform

also remember to validate and auth

alt text

adding a timeout

alt text

fallback need to be above await

if changes happens in suspense

alt text put key so that if the key changes the fallback will happen(trigger)

redirect cant be use in trycatch

alt text error

the correct way is alt text