📌 Summary
Projects are successfully stored in the database but are not displayed in the UI after a page refresh. This results in a mismatch between backend data and frontend state.
📖 Description
When a user creates a project, it is immediately visible in the UI and correctly saved in the database. However, upon refreshing the page, the UI fails to fetch and display the existing projects.
Verification via Supabase dashboard confirms that the data is persisted correctly. The issue appears to be related to data retrieval, authorization (RLS), or frontend rendering logic rather than data insertion.
🔁 Steps to Reproduce
- Create a new project via the UI
- Observe that the project appears in the list
- Open Supabase → confirm the project row exists in
projects table
- Refresh the page
- Observe that the project is no longer visible in the UI
✅ Expected Behavior
- Projects stored in the database should be fetched on page load
- UI should consistently reflect the current database state
❌ Actual Behavior
- Project data is stored successfully in DB ✅
- UI does not display projects after refresh ❌
🔍 Investigation / Observations
- Insert operation works as expected
- Issue occurs specifically during data fetching after reload
- Likely tied to authentication context or RLS restrictions
⚠️ Possible Root Causes
- Row Level Security (RLS) blocking
SELECT queries
- Missing or incorrect
SELECT policy (auth.uid() = owner_id)
owner_id not matching authenticated user
- User session not initialized before fetch call
- Fetch logic not triggered on component mount / page load
- API route or Supabase client misconfiguration
🛠️ Suggested Fix / Checks
Ensure the following Supabase configuration:
-- Enable RLS
alter table projects enable row level security;
-- Insert policy
create policy insert_own_project on projects
for insert
with check (auth.uid() = owner_id);
-- Select policy
create policy select_own_projects on projects
for select
using (auth.uid() = owner_id);
Additional checks:
- Ensure
owner_id is set using auth.uid() during insert
- Verify user authentication state before fetching data
- Confirm fetch is executed on page load (client/server)
- Check network tab for failed or empty responses
- Avoid duplicate or conflicting policies
🧪 Environment
- Frontend: (e.g., Next.js / React)
- Backend: Supabase
- Database: PostgreSQL
📎 Evidence (Optional)
- Screenshots of DB records
- Network request logs
- Console errors
🚀 Impact
High — affects core functionality (data visibility and user trust)
💡 Notes
This is not a persistence issue. Data is correctly stored but not retrieved or rendered, indicating a problem in the read flow (auth → query → UI state).
📌 Summary
Projects are successfully stored in the database but are not displayed in the UI after a page refresh. This results in a mismatch between backend data and frontend state.
📖 Description
When a user creates a project, it is immediately visible in the UI and correctly saved in the database. However, upon refreshing the page, the UI fails to fetch and display the existing projects.
Verification via Supabase dashboard confirms that the data is persisted correctly. The issue appears to be related to data retrieval, authorization (RLS), or frontend rendering logic rather than data insertion.
🔁 Steps to Reproduce
projectstable✅ Expected Behavior
❌ Actual Behavior
🔍 Investigation / Observations
SELECTqueriesSELECTpolicy (auth.uid() = owner_id)owner_idnot matching authenticated user🛠️ Suggested Fix / Checks
Ensure the following Supabase configuration:
Additional checks:
owner_idis set usingauth.uid()during insert🧪 Environment
📎 Evidence (Optional)
🚀 Impact
High — affects core functionality (data visibility and user trust)
💡 Notes
This is not a persistence issue. Data is correctly stored but not retrieved or rendered, indicating a problem in the read flow (auth → query → UI state).