Whatifweonlydiscardtheresultthatarrivedoutoffordersowecandothisandlet's see, Okay, nowitseemstowork, andyoucanseeherethat I getdirtythought I wantevenbefore I finishedtyping.
Soyeah, youcanseethatthishumblelittlesuchboss, ittookmethreeattemptsuntil I cangetitright.
Andthatbringsmetothefirsttakeawayforthisfirststory, whichistoalwaysrememberaboutthepotentialrestconditionswheneverthat's a waitcall.
Soinordertopreservetheyou'd unidirectionaldataflow, weupdatethedatamodoinsteadandwe'regoingtoletitflowintothe u I.
Andforthisexample, maybemoving a taskis a bitcomplexoperationbecauseitinvolvesboth a taskandthelist.
Soinstead, I'm goingtojustfocusonsomethingsimplersuchass, um, renaming a task.
Sowhen I hit, enterhereisgoingtotriggerandevenHandleranditwillcall a functionhererenamedTaskWishesouractionandfollowingthisbasicpattern, whatwedidisokay.
Andlikethat, thenwemaketheAP I calltosynchronizewiththebackin, andbecausesometimesInternetconnectionmaynotbestablearesomethingwe'rejustgoingonwiththe A P I Ah, weuse a trycashtodisplaytheearlymessagejustforgoodmeasureandthat's it.
That's howweimplementedbasicoptimisticupdatesandformostoffouroperationsinourapp, wewritecodefollowingthisbasicpatternandyouknow, thisworksreallywellandgiveus a reallygreatexperience.
I thinkwecamebacktoourcoatanditbecameclearthatourimplementationoffoptimisticupdatewasindeedtoooptimistic, sothere's noroomforanythingtogowronghereonwhenitdoes.
Wealsodidn't retrytherequest, andthisisreallybadbecauseyouknow, wetriedsohardandputin a lotoffefforttolikeclub a greatexperiencethatthecustomerwouldwanttouse.
Andnowwe'rejustthrowingtheirdataaway.
Andyouknow, that's notwhatwewantforourusers.
But, well, thatwaswhatweimplemented.
Soatthetime, weincorrectlyassumedthatbuilding a singlepageLeo, TimecollaborativeUpandtaskmanagementabs.
Youknow, it's It's justlikecrud.
APScreaterateuptheirdelayed, that's all.
That's mostlywhatitdoes.
Soitshouldbe a simpleasschoolmultipageapplicationbecauseright, because, youknow, that's whatweknow.
That's whatwe'refamilyorwith.
AndifyoulikeRubyonLeo's, Yeah, doing a createthingisjust a simpleasthat.
So D'Amato s caseswetrytosolvethemoredaysseemtocomeup.
Andwhataboutmorecomplexoperationsthatjustlikemoving a taskbetweenlistHowhowmuchaccomplishedwouldourcourtbeifweweretohandleallthecasesinofftheseoperations, ifthere's somethingfundamentallywrongwiththewaywe'rewritingcode.
So I tookanothersetbackandthinkaboutthewayweareopposingoptimisticupdates.
Andthen I realizedthatifwewanttohaveeventualconsistency, wemusttrytostickwiththegroundtruth.
I defineditastheletterstatethatwereceivefromtheLord.
Butourusermaybeusingourupfrom a mobile, thewife, anditmightnotbepracticaltodothat.
Sowedecidedtoalsosaythankyoutotheclientstartedandthatgiveusas a bonus, giveus a buildingblockthatifwewanttomakeourupwardofflineinthefuturebecause, youknow, progressiveWebappsarebecomingmorepopularthisyear.
Ah, soyeah, that's a goodbonusforforpersistingtoocutetotheclient's knowledge.
So, asyoucansee, therewants a lotoffcasesthatwehavetohandletomakeourmoreresilientandtopreventthat a lossthatbringsmetothetakeawaythatfirst, I didn't knowthatwritingascrudabswouldhavetobethiscomplex.
Youknow, there's a lotofftutorialsouttherechasingyourto, likehowtomake a realtimetodoapplicationcollaborativeusinglesseyesocket I Oh, I'veneverseenanyoffthem.
Wantmeaboutthiswhen?
Sothesearetheproblems.
RephrasewhenwetrytobuildproductionqualityAPS, andthat's why I wanttogivethistalksomuch.
Sotoclosethistalk, I wouldconsiderthistalk a successifyougohometodayandbecomemorecarefulwhenyouseethekeywouldawaitinyourcourtbased, youdon't havetobeparanoid.
I don't knowifthat's paranoidornot, butbutandmaybewhenyoutestyourapptrieddoubleclickingeverythinginsteadoffsingleclickingandthenexttimeyouseeallrighttherewouldawait.