[{"data":1,"prerenderedAt":139},["ShallowReactive",2],{"work-\u002Fwork\u002Fsenior-care-platform":3},{"_path":4,"_dir":5,"_draft":6,"_partial":6,"_locale":7,"title":8,"description":9,"tags":10,"role":16,"duration":17,"client":18,"client_named":6,"permission":6,"featured":19,"order":20,"body":21,"_type":132,"_id":133,"_source":134,"_file":135,"_stem":136,"_extension":137,"sitemap":138},"\u002Fwork\u002Fsenior-care-platform","work",false,"","Offline media in a legacy senior-care platform","Made a communication platform work on unreliable connections with an IndexedDB media cache and a fallback for expired S3 URLs, and fixed a popup bug caused by a timer attached to reused DOM.",[11,12,13,14,15],"JavaScript","jQuery","IndexedDB","AWS S3","Legacy","Frontend engineer","3 months","A US senior-care communication platform",true,3,{"type":22,"children":23,"toc":124},"root",[24,33,39,44,50,55,60,65,71,82,92,102,108,113,119],{"type":25,"tag":26,"props":27,"children":29},"element","h2",{"id":28},"context",[30],{"type":31,"value":32},"text","Context",{"type":25,"tag":34,"props":35,"children":36},"p",{},[37],{"type":31,"value":38},"A communication platform used in senior-care settings, where families and staff share photos and\nvideo messages with residents. An older codebase — jQuery still doing real work in it — with\nproduction users who were not going to wait for a rewrite.",{"type":25,"tag":34,"props":40,"children":41},{},[42],{"type":31,"value":43},"Client details are withheld here; I do not have written permission to name them.",{"type":25,"tag":26,"props":45,"children":47},{"id":46},"the-hard-problem",[48],{"type":31,"value":49},"The hard problem",{"type":25,"tag":34,"props":51,"children":52},{},[53],{"type":31,"value":54},"Two things, both about state that outlives the code that created it.",{"type":25,"tag":34,"props":56,"children":57},{},[58],{"type":31,"value":59},"Media was served from S3 behind pre-signed URLs, which expire. The application fetched a URL,\nheld onto it, and used it later — so a page open long enough would try to load media through a link\nthat was no longer valid. On top of that, the connections in these buildings were not reliable, and\nreloading media that had already been viewed was wasteful and often failed.",{"type":25,"tag":34,"props":61,"children":62},{},[63],{"type":31,"value":64},"Separately, a popup was appearing at the wrong moment and for the wrong record.",{"type":25,"tag":26,"props":66,"children":68},{"id":67},"what-i-did",[69],{"type":31,"value":70},"What I did",{"type":25,"tag":34,"props":72,"children":73},{},[74,80],{"type":25,"tag":75,"props":76,"children":77},"strong",{},[78],{"type":31,"value":79},"Cached media in IndexedDB, offline-first.",{"type":31,"value":81}," Media already fetched gets served from local storage\nrather than re-requested, so a poor connection degrades the experience instead of breaking it.",{"type":25,"tag":34,"props":83,"children":84},{},[85,90],{"type":25,"tag":75,"props":86,"children":87},{},[88],{"type":31,"value":89},"Added a fallback for expired S3 URLs.",{"type":31,"value":91}," Rather than treating a URL as permanent, an expired link\ntriggers a re-fetch of a fresh pre-signed URL and retries, transparently. The fix is in how the\napplication treats URL lifetime, not in extending the expiry.",{"type":25,"tag":34,"props":93,"children":94},{},[95,100],{"type":25,"tag":75,"props":96,"children":97},{},[98],{"type":31,"value":99},"Traced the popup bug to a timer on reused DOM.",{"type":31,"value":101}," The element the timer was attached to was being\nrecycled rather than recreated, so the old timer survived and fired against whatever record\noccupied that node next. It looked like a race condition and was not one — it was a lifecycle\nassumption that stopped being true once the list started reusing nodes. The fix was clearing the\ntimer at the point the node is reused.",{"type":25,"tag":26,"props":103,"children":105},{"id":104},"outcome",[106],{"type":31,"value":107},"Outcome",{"type":25,"tag":34,"props":109,"children":110},{},[111],{"type":31,"value":112},"Media loads from cache on repeat views and recovers on its own when a URL expires, rather than\nshowing a broken asset. The popup fires against the record it belongs to.",{"type":25,"tag":26,"props":114,"children":116},{"id":115},"stack",[117],{"type":31,"value":118},"Stack",{"type":25,"tag":34,"props":120,"children":121},{},[122],{"type":31,"value":123},"JavaScript, jQuery, IndexedDB, AWS S3 pre-signed URLs.",{"title":7,"searchDepth":125,"depth":125,"links":126},2,[127,128,129,130,131],{"id":28,"depth":125,"text":32},{"id":46,"depth":125,"text":49},{"id":67,"depth":125,"text":70},{"id":104,"depth":125,"text":107},{"id":115,"depth":125,"text":118},"markdown","content:work:senior-care-platform.md","content","work\u002Fsenior-care-platform.md","work\u002Fsenior-care-platform","md",{"loc":4},1790598049477]