<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: ATAYERO CLINTON</title>
    <description>The latest articles on DEV Community by ATAYERO CLINTON (@atayeroclinton).</description>
    <link>https://dev.to/atayeroclinton</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1349950%2Fa460c97d-8912-46a5-8159-c624d8bc7bd2.jpg</url>
      <title>DEV Community: ATAYERO CLINTON</title>
      <link>https://dev.to/atayeroclinton</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/atayeroclinton"/>
    <language>en</language>
    <item>
      <title>Debugging the Google Maps Duplicate Loading Bug in React</title>
      <dc:creator>ATAYERO CLINTON</dc:creator>
      <pubDate>Wed, 10 Jun 2026 18:38:32 +0000</pubDate>
      <link>https://dev.to/atayeroclinton/debugging-the-google-maps-duplicate-loading-bug-in-react-1i69</link>
      <guid>https://dev.to/atayeroclinton/debugging-the-google-maps-duplicate-loading-bug-in-react-1i69</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;Originally published on &lt;a href="https://www.clintech.me/blog/google-maps-duplicate-loading-bug" rel="noopener noreferrer"&gt;clintech.me&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;If you've integrated Google Maps into a React app and seen &lt;br&gt;
Autocomplete randomly stop working, Directions silently fail, &lt;br&gt;
or the API throw &lt;code&gt;google is not defined&lt;/code&gt; on second render — &lt;br&gt;
you've hit the duplicate loading bug.&lt;/p&gt;

&lt;p&gt;Here's exactly what caused it in my case and how I fixed it.&lt;/p&gt;
&lt;h2&gt;
  
  
  The setup that broke things
&lt;/h2&gt;

&lt;p&gt;While building delivery address flows at &lt;br&gt;
&lt;a href="https://polom.ng" rel="noopener noreferrer"&gt;POLOM&lt;/a&gt; — a production e-commerce platform — &lt;br&gt;
I integrated Google Places Autocomplete across 20+ screens.&lt;/p&gt;

&lt;p&gt;I had the Maps JavaScript API loading in two places:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A &lt;code&gt;provider.tsx&lt;/code&gt; for global script loading across the app&lt;/li&gt;
&lt;li&gt;A &lt;code&gt;useLoadGoogleMaps&lt;/code&gt; hook inside a shared component&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This caused race conditions. The &lt;code&gt;Autocomplete&lt;/code&gt; and &lt;code&gt;Directions&lt;/code&gt; &lt;br&gt;
APIs were initialising before the script fully resolved in some &lt;br&gt;
renders, silently failing in others. The failure wasn't &lt;br&gt;
consistent, which made it harder to catch.&lt;/p&gt;
&lt;h2&gt;
  
  
  The fix
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Step 1 — Remove the global load&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
Delete the script tag or &lt;code&gt;next/script&lt;/code&gt; call in &lt;code&gt;provider.tsx&lt;/code&gt;. &lt;br&gt;
There should be exactly one place the Maps API loads.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 2 — Centralise in a hook&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
Move all loading logic into a single &lt;code&gt;useLoadGoogleMaps&lt;/code&gt; hook &lt;br&gt;
using dynamic loading. If you're on Next.js, &lt;code&gt;next/script&lt;/code&gt; &lt;br&gt;
with &lt;code&gt;strategy="afterInteractive"&lt;/code&gt; inside the hook is the &lt;br&gt;
right approach.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 3 — Guard before initialising&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="nb"&gt;window&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;google&lt;/span&gt;&lt;span class="p"&gt;?.&lt;/span&gt;&lt;span class="nx"&gt;maps&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;return&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Check that the API is fully available before attempting to &lt;br&gt;
attach &lt;code&gt;Autocomplete&lt;/code&gt; or &lt;code&gt;Directions&lt;/code&gt;. Don't assume the script &lt;br&gt;
load event means every namespace is ready.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 4 — Scope your ref correctly&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
Bind the autocomplete instance to &lt;code&gt;inputRef.current&lt;/code&gt; explicitly. &lt;br&gt;
If the component remounts, re-initialise the binding — don't &lt;br&gt;
assume the previous instance is still attached.&lt;/p&gt;

&lt;h2&gt;
  
  
  The result
&lt;/h2&gt;

&lt;p&gt;One load, one source of truth, no race conditions. Autocomplete &lt;br&gt;
and Directions worked consistently across all 20+ screens &lt;br&gt;
without reinitialising on every render.&lt;/p&gt;

&lt;h2&gt;
  
  
  Security — the step most developers skip
&lt;/h2&gt;

&lt;p&gt;Restrict your API key at the Google Cloud Console level:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;HTTP referrers:&lt;/strong&gt; whitelist your domain only 
(e.g. &lt;code&gt;https://yourapp.com/*&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;API restrictions:&lt;/strong&gt; enable only the services you actually 
use — Maps JavaScript API, Places, Directions. 
Nothing else.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;An unrestricted Maps key on a public frontend will get scraped &lt;br&gt;
and abused. It happens faster than you'd expect.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;I'm a frontend engineer open to remote EU roles — &lt;br&gt;
&lt;a href="https://www.linkedin.com/in/clinton-atayero-3800b5238/" rel="noopener noreferrer"&gt;connect on LinkedIn&lt;/a&gt; &lt;br&gt;
if this was useful.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>react</category>
      <category>webdev</category>
      <category>googlemaps</category>
    </item>
    <item>
      <title>How I Built Multi-User Apps with Row-Level Security in Supabase</title>
      <dc:creator>ATAYERO CLINTON</dc:creator>
      <pubDate>Wed, 03 Jun 2026 17:05:31 +0000</pubDate>
      <link>https://dev.to/atayeroclinton/how-i-built-multi-user-apps-with-row-level-security-in-supabase-51o0</link>
      <guid>https://dev.to/atayeroclinton/how-i-built-multi-user-apps-with-row-level-security-in-supabase-51o0</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;Originally published on &lt;a href="https://www.clintech.me/blog/building-multi-user-apps-with-rls" rel="noopener noreferrer"&gt;clintech.me&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;When you move from toy projects to real products, the hard problem &lt;br&gt;
isn't styling cards. It's isolation: how do you make sure each user &lt;br&gt;
only sees their own data?&lt;/p&gt;

&lt;p&gt;The wrong answer: filter by &lt;code&gt;userId&lt;/code&gt; in React and hope no one cheats.&lt;br&gt;&lt;br&gt;
The right answer: Row-Level Security.&lt;/p&gt;
&lt;h2&gt;
  
  
  What RLS actually is
&lt;/h2&gt;

&lt;p&gt;RLS is a Postgres feature that enforces access policies at the database &lt;br&gt;
level — not the application level. Every query runs through your &lt;br&gt;
policies before returning data.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;CREATE&lt;/span&gt; &lt;span class="n"&gt;POLICY&lt;/span&gt; &lt;span class="nv"&gt;"Users can see their own jobs"&lt;/span&gt;
&lt;span class="k"&gt;ON&lt;/span&gt; &lt;span class="n"&gt;jobs&lt;/span&gt; &lt;span class="k"&gt;FOR&lt;/span&gt; &lt;span class="k"&gt;SELECT&lt;/span&gt;
&lt;span class="k"&gt;USING&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;user_id&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;auth&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;uid&lt;/span&gt;&lt;span class="p"&gt;());&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;With this in place, even if someone opens DevTools and calls the &lt;br&gt;
Supabase REST API directly with a valid token, they still only get rows &lt;br&gt;
where &lt;code&gt;user_id&lt;/code&gt; matches their own auth UID. The database is the &lt;br&gt;
security gate, not your frontend.&lt;/p&gt;

&lt;h2&gt;
  
  
  How I applied this in ApplyCraft
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://apply-craft.vercel.app" rel="noopener noreferrer"&gt;ApplyCraft&lt;/a&gt; is an AI-powered job &lt;br&gt;
tracker I built. Every job, note, and profile is scoped per user. &lt;br&gt;
The policy pattern is consistent across all tables:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;jobs.user_id = auth.uid()&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;job_notes.user_id = auth.uid()&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;profiles.id = auth.uid()&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Even the server-side AI endpoint, which writes outreach copy back &lt;br&gt;
to a job row, verifies ownership before touching the database. &lt;br&gt;
No client-side key exposure, no trust in the frontend.&lt;/p&gt;

&lt;h2&gt;
  
  
  The mistakes that will burn you
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;1. Enabling RLS but leaving "allow all" policies&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
You've technically turned it on but effectively disabled it. &lt;br&gt;
Every policy needs to be explicit.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. Forgetting write policies&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
Easy to add &lt;code&gt;SELECT&lt;/code&gt; and forget &lt;code&gt;INSERT&lt;/code&gt;, &lt;code&gt;UPDATE&lt;/code&gt;, &lt;code&gt;DELETE&lt;/code&gt;. &lt;br&gt;
Your app will silently fail on writes and you'll spend an hour &lt;br&gt;
wondering why.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. Trusting only frontend filters&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
If a table has unrestricted &lt;code&gt;SELECT&lt;/code&gt;, any user can bypass your &lt;br&gt;
UI and call the REST endpoint directly. RLS removes that &lt;br&gt;
possibility entirely.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;4. Not following the ownership chain on joins&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
If &lt;code&gt;notes&lt;/code&gt; belongs to &lt;code&gt;jobs&lt;/code&gt; and &lt;code&gt;jobs&lt;/code&gt; belongs to a user, your &lt;br&gt;
note policies should check ownership through that chain, not &lt;br&gt;
just assume the foreign key is enough.&lt;/p&gt;




&lt;p&gt;The difference between "multi-user UI" and "multi-tenant product" &lt;br&gt;
is where security lives. Once the database enforces it, your &lt;br&gt;
frontend gets simpler and your app gets much harder to abuse.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;I'm a frontend engineer open to remote EU roles, connect with &lt;br&gt;
me on &lt;a href="https://www.linkedin.com/in/clinton-atayero-3800b5238/" rel="noopener noreferrer"&gt;LinkedIn&lt;/a&gt; &lt;br&gt;
if this was useful.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>supabase</category>
      <category>react</category>
      <category>javascript</category>
      <category>webdev</category>
    </item>
  </channel>
</rss>
