<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Dorell James on Medium]]></title>
        <description><![CDATA[Stories by Dorell James on Medium]]></description>
        <link>https://medium.com/@dorelljames?source=rss-5dfe1d37052e------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*mUV1ypyFeQNlUNL5jia32Q.jpeg</url>
            <title>Stories by Dorell James on Medium</title>
            <link>https://medium.com/@dorelljames?source=rss-5dfe1d37052e------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 20 Nov 2026 05:00:53 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@dorelljames/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Why does one write?]]></title>
            <link>https://dorelljames.medium.com/why-does-one-write-a35b7822c140?source=rss-5dfe1d37052e------2</link>
            <guid isPermaLink="false">https://medium.com/p/a35b7822c140</guid>
            <dc:creator><![CDATA[Dorell James]]></dc:creator>
            <pubDate>Sat, 23 May 2026 10:30:15 GMT</pubDate>
            <atom:updated>2026-05-23T10:30:15.108Z</atom:updated>
            <content:encoded><![CDATA[<p>I’ll be real honest here! I asked this question to ChatGPT and it gave me answers. Answers that could have come first from my own thoughts, yet I offset that thinking and accepted the answer to a question without fully grasping what it is for me.</p><p>I can barely remember what ChatGPT returned and I can also can’t quite come up with a good answer for myself. Before I call this as a problem, perhaps, there’s something going on here that I need to dissect.</p><p>What’s happening?</p><p>Why is this happening?</p><p>Right now, it points me towards this idea that every thought that we have were not originally ours but it’s what we’ve learned from everything we’ve heard, saw, and got influenced from.</p><p>So to me, this can only mean that if we never learn to question our thoughts and assumptions, we’ll always just accept the idea of others, especially those who have articulated it for us, even if it doesn’t really exactly capture everything we think for ourselves. It’s also usually the last parts that separate us from being general — not that it’s inherently bad but because we should look out for ourselves.</p><p>Now, I can see how we’ve grown to accustom to be what I call “lazy in thinking”. It’s like a quick Google search to find the answers to your questions but it’s more bad now because the explanations that you often come by yourself are now being outsourced to an AI model who does not totally have the context of your entire life.</p><p>And so, I think for me, writing is a way. A way to think for myself, and especially first. A way to examine what is something about and how does it relate to me. But on a deeper level, I want to grasp the depth of my thoughts and share it in the way I want it to be understood — not polished but good enough for a human being to relate and understood.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a35b7822c140" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[p r o g r e s s . . .]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://dorelljames.medium.com/p-r-o-g-r-e-s-s-b5ed3841f501?source=rss-5dfe1d37052e------2"><img src="https://cdn-images-1.medium.com/max/1070/1*o8z6XsVYSbNYwcvLyzfPuw@2x.png" width="1070"></a></p><p class="medium-feed-snippet">Year in progress&#x200A;&#x2014;&#x200A;64%&#x2026;</p><p class="medium-feed-link"><a href="https://dorelljames.medium.com/p-r-o-g-r-e-s-s-b5ed3841f501?source=rss-5dfe1d37052e------2">Continue reading on Medium »</a></p></div>]]></description>
            <link>https://dorelljames.medium.com/p-r-o-g-r-e-s-s-b5ed3841f501?source=rss-5dfe1d37052e------2</link>
            <guid isPermaLink="false">https://medium.com/p/b5ed3841f501</guid>
            <dc:creator><![CDATA[Dorell James]]></dc:creator>
            <pubDate>Sat, 23 Aug 2025 01:09:19 GMT</pubDate>
            <atom:updated>2025-08-23T01:09:19.513Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[3/52: Solopreneurship Journey]]></title>
            <link>https://dorelljames.medium.com/3-52-solopreneurship-journey-b9f927c6e247?source=rss-5dfe1d37052e------2</link>
            <guid isPermaLink="false">https://medium.com/p/b9f927c6e247</guid>
            <category><![CDATA[solopreneurship]]></category>
            <category><![CDATA[entrepreneurship]]></category>
            <dc:creator><![CDATA[Dorell James]]></dc:creator>
            <pubDate>Sun, 12 Jan 2025 09:16:21 GMT</pubDate>
            <atom:updated>2025-01-12T09:16:21.753Z</atom:updated>
            <content:encoded><![CDATA[<p>This week didn’t go exactly how I wanted it to be. I thought I’d be able to double down on my efforts and get a lot of things done but it seems as far as I how I feel about things, I haven’t quite made a lot of progress. I orinally planned to have <a href="https://12in12.pro/"><strong>12 in 12 challenge</strong></a><strong> </strong>more structure but I guess I have failed that. Also, the onboarding that I hoped to finally iron out is far from being done and dusted. I don’t want to make excuses here and there, all I know is I failed short of what I should have done. I don’t want to beat myself up for this because not only it is detrimental to my whole being but it’ll just makextts things worse.</p><p>Anyways, too much of that. I wrote about a lot of things yesterday and I have at least came up with a plan to also put structure on what I’m doing to be able to measure whether things are effective and also to keep myself accountable. I don’t quite like this idea at first but I think it’s going to be useful with what I’m doing. I’m not entirely fixated but this is more of me as I go through all of this, learning, and iterating, I’ll apply what’s useful for me and what not. So, I’ll be planning and will lay out the specific tasks to accomplish on a given week and don’t try to go over that. Once again, it is important to remain and establish the work life balance. After all, this isn’t about really reaching the goal but more on enjoying the journey for me, to learn, to grow and all. If I get fixated on the goal, which by the way is beyond my control, I don’t think I’ll ever get it. Worst is what could happen if I really don’t, right?</p><p>So, by next week, here are the things I want to do and accomplish.</p><ol><li>Onboarding for 12 in 12 in Discord.</li><li>A short course on solopreneurship</li><li>A short guide on how to make use of the Discord server and its community</li><li>The 12in12 profile page. Build in public couldn’t be more easier with this, right? Here’s an example page: <a href="https://12in12.pro/dorelljames">https://12in12.pro/dorelljames</a></li></ol><p>That’s it for 12 in 12.</p><p>Now for <a href="http://getcebby.com/">Cebby</a> below:</p><ol><li>Ship the <a href="https://github.com/getcebby/cebby/pull/37">partners page</a>.</li><li>Multiple hosts support — primary and co-host. This should show up properly and correct the old events that were not.</li></ol><p>I guess that’s it for now.</p><p>As I draw close to the end of the month, I plan to launch in public 12 in 12 and make a formal announcement on it in my social media. I also make sure that people understand what it is and what’s it not and how they can make use of it as well. As of now, this is more of like an initiative but perhaps as more and more people join, the value of this will become more apparent.</p><p>That’s it for this week. I’ll see onto the next! 😊</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b9f927c6e247" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The start of my solopreneurship journey]]></title>
            <link>https://dorelljames.medium.com/the-start-of-my-solopreneurship-journey-69e1d10e1fed?source=rss-5dfe1d37052e------2</link>
            <guid isPermaLink="false">https://medium.com/p/69e1d10e1fed</guid>
            <category><![CDATA[solopreneurship]]></category>
            <dc:creator><![CDATA[Dorell James]]></dc:creator>
            <pubDate>Sun, 05 Jan 2025 03:17:13 GMT</pubDate>
            <atom:updated>2025-01-05T03:17:13.217Z</atom:updated>
            <content:encoded><![CDATA[<p>As simple as that title gets, I want to have a place where I can unload all these thoughts, feelings and everything in between on my journey to have that freedom that I always wanted in the future and to prove to myself that I can make it on my own.</p><p>I will keep editing this or perhaps right a new one every now and then. I don’t think I plan to write every day but perhaps at least a week or two would be great and/or occasions where I feel like it’s important to write it down.</p><p>Let’s start of with what I’ve planned to do and announced this year to do.</p><p>First on my list is I took on the challenge to do <strong>12 products (or startups) in 12 months — </strong><a href="https://dub.sh/12productsin12months">you can read about that here</a>. Everyone seems to be on their own journey, advancing in their careers by doing certifications, acquiring new skills and more but for at this point, I want to make use of my knowledge and skills to put something out there that has a potential to be useful for people enough for them to pay. The product has to have some value from it and it first goes as to make people get inspired and aware what is this all about.</p><p>I’m extremely hopeful that this could work out. As I go back to work this Monday and the things from the community also coming back, I find myself having less and less time to focus on my goal here. I have at least learned to protect my time but as of the moment, I feel overwhelmed on the lefts and rights of things.</p><p>Did I succeed in this 1st week? As I can recall, I have established the Discord community where you can join today <a href="https://discord.com/invite/mKefA6t3ha">via this link</a> if you want to join. It has also become apparently clear as well what I needed to do based from the lack that I lack and I think I needed to know to set up, etc. Or perhaps, I should be focusing more on finding those ideas and validating them as quickly as I can instead of learning how to set up for example, email list and sequences and/or how to integrate payments to the app and/or landing page where I’ll try to sell my product.</p><p>Anyways, my goal at least for this month is to really turn the <strong>12 products (or startups) in 12 months</strong> into something that can be useful and create a value for this.</p><p>See you y’all next week! 😅</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=69e1d10e1fed" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Every single day, we wish probably want to change something!]]></title>
            <link>https://dorelljames.medium.com/every-single-day-we-wish-probably-want-to-change-something-3dcd0c4318c3?source=rss-5dfe1d37052e------2</link>
            <guid isPermaLink="false">https://medium.com/p/3dcd0c4318c3</guid>
            <dc:creator><![CDATA[Dorell James]]></dc:creator>
            <pubDate>Thu, 29 Aug 2024 13:54:59 GMT</pubDate>
            <atom:updated>2024-08-29T13:57:08.547Z</atom:updated>
            <content:encoded><![CDATA[<p>Every single day, we wish probably want to change something! Whatever that is, it’s most likely a combination of what your ideal self would be and other things. The biggest problem is how can I get to that “me”.</p><p>It is easy to dismiss ourselves. For example, not being able to eat less than I should do today would then make us feel that we’ve lost the battle.</p><p>Or when we finally managed to make a streak then suddenly, we lose a day, then we can be the greatest critic to ourselves. We then forget all about the right things we did and just focus on how we failed to keep up.</p><p>Or when where things have been doing well, you started and keep at it and it turned to a habit and as days passed by when it became too challenging to keep up — must be burnout, i don’t know! But the thing is, you thought honestly that this is it! This is how your life turned up yet you find yourself after countless of hours listening to all motivational videos, speech or whatever there is, finding that right time and day that you can finally say to yourself that this is it, this is the turning point of my life. But… as may it maybe as long as you want to deny it, you start to get demotivated to the point where you no longer can keep up with the things you started.</p><p>That is fine, really! As long as you can get back up and try again. I guess most underplay how difficult can it be to sum up all your being to try again. I am at this stage right now. Almost every attempt of my being is being tested. Every single day, I struggle to find myself, to sum up the courage, to motivate myself, to bring every fiber of my being to stick to that one thing! I really don’t know…</p><p>—</p><p>How are you?</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3dcd0c4318c3" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Headless CMS Workshop]]></title>
            <link>https://blog.jscebu.org/headless-cms-workshop-93cb0991f3c2?source=rss-5dfe1d37052e------2</link>
            <guid isPermaLink="false">https://medium.com/p/93cb0991f3c2</guid>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[headless-cms]]></category>
            <category><![CDATA[strapi]]></category>
            <dc:creator><![CDATA[Dorell James]]></dc:creator>
            <pubDate>Thu, 22 Aug 2024 01:55:11 GMT</pubDate>
            <atom:updated>2024-08-27T00:33:00.150Z</atom:updated>
            <content:encoded><![CDATA[<p>August is coming to a close but we’ve managed to pull another workshop once again for the JS family and the community.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PQuiaTgtJP_8uxb9umrHLw.jpeg" /><figcaption>Headless CMS Workshop photo-op</figcaption></figure><p>Our goal this year for JS Cebu is to do more than talks and really get in depth into learning by doing hands-on coding.</p><p>In this particular workshop, our very own, <a href="https://medium.com/u/5dfe1d37052e">Dorell James</a> did an intro talk about headless CMS and he took us to a journey way back when the internet started and how websites were created at that time up until how today. His presentation can be <a href="https://drive.google.com/file/d/1F_oGsm9uS9z4k-GKIMZrRVRGhwPRql72/view?usp=sharing">downloaded in PDF format here</a>.</p><p><a href="https://medium.com/u/628e1a82d66d">Jhury Kevin</a>, our invited speaker and workshop master demonstrated Strapi and its capabilities. He demonstrated the awesome features of the said OSS project from content modeling, to roles and access control, its automatic REST API and GraphQL features and even pulling off an anime web catalogue. The final product of his talk can be <a href="https://github.com/Lavelliane/anime-reviews-sa">found here</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*U0aND90oVSAibvGW8L9YgA.png" /><figcaption>Here’s a personal photo I had with him (Jhury) before he head out after giving his talk.</figcaption></figure><p>Overall the workshop was a success and we thank nonetheless our awesome event partners of this event, <a href="https://www.facebook.com/enspacecebu">enspace Cebu</a>, <a href="https://www.facebook.com/LegalMatchPH">LegalMatch Philippines</a> and <a href="https://www.facebook.com/SunAsteriskInc/">Sun Asterisk</a> with special mention to Ms. Honey, Ms. Christine and Ms. Elle who were our key persons for this event.</p><p>PS: We have a LIVE coverage by the way of this event, <a href="https://www.facebook.com/JavaScriptCebu/videos/1194618598246078/">please find this link useful</a>. 💛</p><p>On to the next event. see yahh! 🦖</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=93cb0991f3c2" width="1" height="1" alt=""><hr><p><a href="https://blog.jscebu.org/headless-cms-workshop-93cb0991f3c2">Headless CMS Workshop</a> was originally published in <a href="https://blog.jscebu.org/">JavaScript Cebu</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The Automated Testing Workshop]]></title>
            <link>https://blog.jscebu.org/the-automated-testing-workshop-84ba47649aab?source=rss-5dfe1d37052e------2</link>
            <guid isPermaLink="false">https://medium.com/p/84ba47649aab</guid>
            <category><![CDATA[workshop]]></category>
            <category><![CDATA[quality-assurance]]></category>
            <category><![CDATA[automated-testing]]></category>
            <category><![CDATA[testing]]></category>
            <dc:creator><![CDATA[Dorell James]]></dc:creator>
            <pubDate>Sun, 14 Jul 2024 02:40:58 GMT</pubDate>
            <atom:updated>2024-07-14T02:40:58.452Z</atom:updated>
            <content:encoded><![CDATA[<p>This year 2023, I’ve had the opportunity to speak about testing when I was invited by dear students in USC-TC to talk about the importance of testing — <a href="https://docs.google.com/presentation/d/1D0w4txy0_aBkdf4Gz3y5ReuIwH_zmc3m2kxmR-A1Wn0/edit?usp=sharing">view my slides here</a>.</p><p>Ever since, the <a href="https://www.facebook.com/javascriptcebu">JavaScript Cebu (JS Cebu) community</a> had been doing meetups through its sub-communities — <a href="https://www.facebook.com/reactcebu">React Cebu</a>, <a href="https://www.facebook.com/angularcebu">Angular Cebu</a> and <a href="https://www.facebook.com/vuejscebu">VueJS Cebu</a> — but one of our higher goals this year was to do more by doing workshops and the likes where people really learn practical skills.</p><p>Testing among other things has been one of the things that’s really close to my heart and so I thought why not take this opportunity to do more about it. Thus, the Automated Testing Workshop came to its fruition.</p><p>By end of this month, we’ll be doing the 3rd part which is for developers — <a href="https://www.facebook.com/events/2461687577349594/">see event link here</a>. The said workshop will cover static analysis, unit and integration testing.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*qPkBOq73Idr7ry3q" /><figcaption><a href="https://www.facebook.com/events/2461687577349594/">https://www.facebook.com/events/2461687577349594/</a></figcaption></figure><p>But before this one, we’ve had the 2nd part done last month of June which is specifically tailored for QA (Testers) and basically everyone — <a href="https://www.facebook.com/events/1182364746111110/">see event here</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*9TUtDT9yiPnUk-OC" /><figcaption>Automated Testing Workshop for Testers / Everyone groupfieeee</figcaption></figure><p>In this workshop we focused on learning End-To-End Testing with Playwright. The participants not only learned to setup Playwright but also wrote their first few tests using codegen and they were also up for the challenges as well.</p><p>Miss it? You’re in luck as here’s the <a href="https://dub.sh/atwtestersworkshop">actual workshop hand-guide which you can do it on your own</a>.</p><p>and the <a href="https://www.facebook.com/events/401343119377232/">first one last May</a> which is basically an introduction to all types of testing — static analysis, unit testing, integration testing and end-to-end testing.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*jUIBcSKUCI4mdjh-" /><figcaption>Automated Testing Workshop — Intro</figcaption></figure><p>This event workshop had been nothing without the support of the awesome <a href="https://www.facebook.com/enspacecebu">enspace Cebu</a> and <a href="https://www.facebook.com/LegalMatchPH">LegalMatch Philippines</a> with special mention to Ms. Christine and Ms. Elle who we had been working with us ever since.</p><p>What now? We still have August kinda free up so if you have something in mind, let us know but rest assured we’re already baking something for September and a hint would probably we’re doing a party 💛 and last but not the least, October is fast approaching and we’ll do <a href="https://www.facebook.com/events/271078315274279">Hacktoberfest once again with a bang just like last year</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=84ba47649aab" width="1" height="1" alt=""><hr><p><a href="https://blog.jscebu.org/the-automated-testing-workshop-84ba47649aab">The Automated Testing Workshop</a> was originally published in <a href="https://blog.jscebu.org/">JavaScript Cebu</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[First attempt]]></title>
            <link>https://medium.com/newbdesigner/first-attempt-5a048a72baff?source=rss-5dfe1d37052e------2</link>
            <guid isPermaLink="false">https://medium.com/p/5a048a72baff</guid>
            <dc:creator><![CDATA[Dorell James]]></dc:creator>
            <pubDate>Wed, 14 Feb 2024 05:45:35 GMT</pubDate>
            <atom:updated>2024-02-14T05:45:35.673Z</atom:updated>
            <content:encoded><![CDATA[<p>Look at that. I whipped up something that I got to use in my Notion account. 😅</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/341/1*qSGGW7yA-zHCqTzOQY2c_A@2x.png" /></figure><p>Here’s the full image below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/329/1*UCAJ2XoJAstKR0hodE5PCw.png" /><figcaption><strong>DJ</strong> are initials for <strong>Dorell James</strong></figcaption></figure><p>— -</p><p>PS: Please don’t expect much on this publication. I’ll just throw it in here my writings and anything that I do to channel out my trapped energies for the things that I should be doing but end up not acting on it.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5a048a72baff" width="1" height="1" alt=""><hr><p><a href="https://medium.com/newbdesigner/first-attempt-5a048a72baff">First attempt</a> was originally published in <a href="https://medium.com/newbdesigner">NewBDesigner</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[REACT-IVATE 2024]]></title>
            <link>https://medium.com/react-cebu/react-ivate-2024-a3cd64ff3d71?source=rss-5dfe1d37052e------2</link>
            <guid isPermaLink="false">https://medium.com/p/a3cd64ff3d71</guid>
            <category><![CDATA[meetup]]></category>
            <category><![CDATA[community]]></category>
            <category><![CDATA[react]]></category>
            <category><![CDATA[techmeetup]]></category>
            <category><![CDATA[cebu]]></category>
            <dc:creator><![CDATA[Dorell James]]></dc:creator>
            <pubDate>Wed, 07 Feb 2024 03:03:59 GMT</pubDate>
            <atom:updated>2024-02-07T03:03:59.601Z</atom:updated>
            <content:encoded><![CDATA[<p>We started this year with a bang!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*0lkPqEsPPKy9gUBy" /></figure><p>1st Community Meetup + FREE Web Design &amp; Web Development Workshop from our speakers, Marc &amp; Geman here at enspace. @followers</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/32/0*XJU2THt39X95SQIq.png" /></figure><ul><li><a href="https://www.facebook.com/reactcebu/videos/react-ivate-24-1st-community-meetup-free-web-design-web-development-workshop-fro/3547625578786933/">REACT-IVATE 24 1st Community Meetup + FREE Web Design &amp; Web Development Workshop from our speakers, Marc &amp; Geman here at enspace. @followers 🙌🏼💙 | React Cebu | J.Tajor · Like I Do (with sunkis)</a></li><li><a href="https://www.facebook.com/reel/1556909178437223">REACT-IVATE 24 &quot;Beginner&#39;s workshop on REACT &amp; AXIOS by guest speaker Geman | React Cebu | React Cebu · Original audio</a></li><li><a href="https://www.facebook.com/reel/3547625578786933">REACT-IVATE 24 1st Community Meetup + FREE Web Design &amp; Web Development Workshop from our speakers, Marc &amp; Geman here at enspace. @followers 🙌🏼💙 | React Cebu | J.Tajor · Like I Do (with sunkis)</a></li></ul><p>Stay tuned for more of this in the next coming months! 😊</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a3cd64ff3d71" width="1" height="1" alt=""><hr><p><a href="https://medium.com/react-cebu/react-ivate-2024-a3cd64ff3d71">REACT-IVATE 2024</a> was originally published in <a href="https://medium.com/react-cebu">React Cebu</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Best and safely update an Array element using @sanity/client — Sanity.io]]></title>
            <link>https://dorelljames.medium.com/best-and-safely-update-an-array-element-using-sanity-client-sanity-io-434c90888a7d?source=rss-5dfe1d37052e------2</link>
            <guid isPermaLink="false">https://medium.com/p/434c90888a7d</guid>
            <category><![CDATA[jamstack]]></category>
            <category><![CDATA[javascript-tips]]></category>
            <category><![CDATA[headless-cms]]></category>
            <category><![CDATA[sanityio]]></category>
            <dc:creator><![CDATA[Dorell James]]></dc:creator>
            <pubDate>Sat, 28 Jan 2023 07:31:48 GMT</pubDate>
            <atom:updated>2023-01-28T07:31:48.296Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3BocR1FdS94KteCzd0R2_A.png" /></figure><h3>Best and safely update an Array element using @sanity/client — Sanity.io</h3><p><em>This post is originally posted on my site’s blog at </em><strong><em>dorelljames.com</em></strong><em>. </em><a href="https://dorelljames.com/blog/best-and-safely-update-an-array-element-using-sanity-client/"><em>Click here if you can’t read the entire article.</em></a></p><p>This one’s a quick post that I thought I’d share that might be useful to our awesome devs out there working with Sanity. This came out after spending some time working on <a href="https://www.webriq.com/w-studio"><strong>WebriQ Studio</strong></a>’s multi-user feature.</p><blockquote>TLDR: Go to Solution #3 and take it from there. We can safely update an array element of a given field by patching via GROQ query and making use of its _id and _rev values. We’re going to use Sanity client’s insert function and replace as its argument value instead of probably mapping out all members and updating only the element we want and do a set as a probable solution, etc.</blockquote><p>So just a quick recap in Sanity client’s documentation, you can add elements to an array like this (meaning it goes at the bottom of the list):</p><pre>client<br>  .patch(&quot;organization-doc-id&quot;)<br>  // Ensure that the `members` arrays exists before attempting to add items to it<br>  .setIfMissing({ members: [] })<br>  // Add the items after the last item in the array (append)<br>  .insert(&quot;after&quot;, &quot;members[-1]&quot;, [<br>    { name: &quot;John&quot;, status: &quot;invited&quot;, dateInvited: Date.now() },<br>  ])<br>  .commit({<br>    // Adds a `_key` attribute to array items, unique within the array, to<br>    // ensure it can be addressed uniquely in a real-time collaboration context<br>    autoGenerateArrayKeys: true,<br>  })</pre><p>and also prepend like this (meaning it goes at at the top of the list):</p><pre>client<br>  .patch(&quot;organization-doc-id&quot;)<br>  .setIfMissing({ members: [] })<br>  // Add the items after the last item in the array (append)<br>  .prepend(&quot;reviews&quot;, [<br>    { name: &quot;John&quot;, status: &quot;invited&quot;, dateInvited: Date.now() },<br>  ])<br>  .commit({ autoGenerateArrayKeys: true })</pre><p>Awesome!</p><h3>Problem: What if we want to update an element in a given Array?</h3><p>Say for example, I have 3 members in my organization document.</p><pre>{<br>  &quot;_id&quot;: &quot;organization-doc-id&quot;,<br>  &quot;_rev&quot;: &quot;revision-1&quot;,<br>  &quot;_type&quot;: &quot;organization&quot;,<br>  &quot;name&quot;: &quot;Dummy Org&quot;,<br>  &quot;members&quot;: [<br>    {<br>      &quot;_id&quot;: &quot;1&quot;,<br>      &quot;name&quot;: &quot;John&quot;,<br>      &quot;status&quot;: &quot;accepted&quot;,<br>      &quot;dateInvited&quot;: &quot;2020-01-02T00:00:00.000Z&quot;,<br>      &quot;dateAccepted&quot;: &quot;2020-01-05T00:00:00.000Z&quot;<br>    },<br>    {<br>      &quot;_id&quot;: &quot;2&quot;,<br>      &quot;name&quot;: &quot;Mary&quot;,<br>      &quot;status&quot;: &quot;invited&quot;,<br>      &quot;dateInvited&quot;: &quot;2020-01-02T00:00:00.000Z&quot;<br>    },<br>    {<br>      &quot;_id&quot;: &quot;3&quot;,<br>      &quot;name&quot;: &quot;Borg&quot;,<br>      &quot;status&quot;: &quot;accepted&quot;,<br>      &quot;dateInvited&quot;: &quot;2020-01-02T00:00:00.000Z&quot;,<br>      &quot;dateAccepted&quot;: &quot;2020-01-05T00:00:00.000Z&quot;<br>    }<br>  ]<br>}</pre><p>and we want to update Mary’s status to accepted and add dateAccepted value to current date.</p><h3>Solution 1: Mapping all elements and set</h3><p>Sure, easy! You could do something like this, right?</p><pre>// Assuming we have the above document data in `organizationDoc`<br>// NOTE: it&#39;s better to use &quot;_id&quot; field for it&#39;s uniqueness but for the sake of this example, we&#39;re opting to use the `name` intentionally<br>const updatedMembers = organizationDoc.members.map((member) =&gt; {<br>  if (member.name === &quot;Mary&quot;) {<br>    return {<br>      ...member,<br>      status: &quot;accepted&quot;,<br>      dateAccepted: new Date(),<br>    }<br>  }<br>  return member<br>})<br><br><br>// So then we can be happy<br>client<br>  .patch(&quot;organization-doc-id&quot;)<br>  // Add the items after the last item in the array (append)<br>  .set(members)<br>  .commit()</pre><p>This might do but it’s probably not the best way of doing this.</p><p>What if we accidentally end up with an empty array of members.</p><p>Imagine!</p><h3>Solution 2 (better): — Only update the given array element and only that</h3><p>Here’s how you can use client.insert function and replace argument value to do just that:</p><pre>// Let&#39;s grab our member&#39;s position(index) in array<br>const memberIndex = organizationDoc.members.findIndex(<br>  (member) =&gt; member.name === &quot;Mary&quot;<br>) // 1<br><br>// Let&#39;s get the member we&#39;re about to update<br>const member = organizationDoc.members[memberIndex]<br>// {<br>//   &quot;_id&quot;: &quot;2&quot;,<br>//   &quot;name&quot;: &quot;Mary&quot;,<br>//   &quot;status&quot;: &quot;invited&quot;,<br>//   &quot;dateInvited&quot;: &quot;2020-01-02T00:00:00.000Z&quot;<br>// }<br><br>// Now, we can just update the element specifically and not the whole `members` field<br>client<br>  .patch(&quot;organization-doc-id&quot;)<br>  // We&#39;re using `replace` here and our `memberIndex` to specifically target the element and replace it instead of adding<br>  .insert(&quot;replace&quot;, `members[${memberIndex}]`, [<br>    { ...member, status: &quot;accepted&quot;, dateAccepted: new Date() },<br>  ])<br>  .commit()</pre><p>Now we’re making progress, we can’t accidentally wipe out the members array data but there’s just one more problem. Guess what that is?</p><p>Well, someone could update the document and members specifically before us. Depending on time order, it could happen. Let’s say you grabbed the organization data from your app on 10:00 AM and someone was working at that time as well in the Sanity studio adding/updating members in and/or some other users from your app quickly managed to also pushed a new member or update. Let’s just say these all happened before 10:05 AM and now by the time we’re going to update, given the current time, our document is pretty outdated. Don’t you think?</p><h3>Solution 3 (best): Only update the given array element and only that at certain revision</h3><p>Sanity offer revision markers as part its <a href="https://www.sanity.io/docs/history-api"><strong>History API</strong></a> marked with the _rev key. This key is unique in every point in time meaning by the time we grabbed the organization document, it’ll have a _rev key that is different from that time when it was updated (older) or its last update (most recent).</p><p>With that, we should do the following:</p><pre>// Given same setup above in Solution 2, we can safely guard updates<br>client<br>  // Notice we now pass a GROQ query to conditionally to make sure we&#39;re updating the current org ID and of specific _rev value<br>  .patch({<br>    query: groq`*[_id == &quot;organization-doc-id&quot; &amp;&amp; _rev == &quot;revision-1&quot;]`,<br>  })<br>  .insert(&quot;replace&quot;, `members[${memberIndex}]`, [<br>    { ...member, status: &quot;accepted&quot;, dateAccepted: new Date() },<br>  ])<br>  .commit()</pre><p>After that patch, our document has been updated to another _rev update after the patch operation above.</p><p>NOTE: The _rev values are sequential and they’re just examples.</p><pre>// NOTE: The `_id` and `_rev` here are example values<br>{ _id: &quot;organization-doc-id&quot;, _rev: &quot;revision-0&quot;, members: [] },<br>{ _id: &quot;organization-doc-id&quot;, _rev: &quot;revision-1&quot;, members: [{...}, {...}, {...}] },<br><br>// Latest version of document after our patch below<br>{ _id: &quot;organization-doc-id&quot;, _rev: &quot;revision-2&quot;, members: [{...}, {...}, {...}] },</pre><p>So if we perform the same patch with GROQ query above, it’ll not work as the current _rev value is now of revision-2, meaning our patch query will not work again.</p><p>Going back in our scenario above, if we’re at revision-1 and it’s not the latest _rev value because someone made it and updated before us, it’ll not overwrite their work and we can happily sleep well at night knowing we didn’t screw up their work anything.</p><p>Yay!</p><h3>What do you think?</h3><p>I thought this might be safer so as not to accidentally remove all members in your array in case we accidentally came up with an empty Array of members we’re about to update or someone updated before us and we accidentally again overwritten their changes.</p><p>Because, you know, it could happen!</p><p>Thank you! I hope this post helps…</p><h3>References</h3><ul><li><a href="https://www.sanity.io/docs/js-client"><strong>Sanity.io JS Client</strong></a></li><li><a href="https://www.sanity.io/docs/history-api"><strong>Sanity.io History API</strong></a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=434c90888a7d" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>