Skip to content

Commit fa03005

Browse files
Merge branch 'main' into fix-supabase-multiple-filters
2 parents 8cb08e3 + 766a87c commit fa03005

34 files changed

Lines changed: 388 additions & 191 deletions

File tree

.changeset/olive-crabs-learn.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
"@refinedev/core": patch
3+
---
4+
5+
[chore: replace outdated and broken `@tanstack/query` links](https://github.com/refinedev/refine/pull/6889)
6+
7+
Updated broken links to `@tanstack/query` documentation for `useMutation` in TSDoc definitions.

documentation/blog/2024-09-05-react-patterns.md

Lines changed: 41 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ image: https://refine.ams3.cdn.digitaloceanspaces.com/blog/2023-10-17-react-patt
88
hide_table_of_contents: false
99
---
1010

11-
**This article was last updated on September 05, 2024, to add sections on Error Boundaries Pattern, Lazy Loading Components, and Memoization Patterns (Memo, useMemo, useCallback).**
11+
**This article was last updated on July 23, 2025, to add a section on React Server Components and their impact on data fetching patterns.**
1212

1313
## Introduction
1414

@@ -26,7 +26,8 @@ Steps we'll cover
2626
- [Lazy Loading Components in React](#lazy-loading-components-in-react)
2727
- [Controlled inputs](#controlled-inputs)
2828
- [Error Boundaries Pattern in React](#error-boundaries-pattern-in-react)
29-
- [Manage custom components with forwardRefs](#manage-custom-components-with-fowardrefs)
29+
- [Manage custom components with forwardRefs](#manage-custom-components-with-forwardrefs)
30+
- [Data Fetching with React Server Components (RSC)](#data-fetching-with-react-server-components-rsc)
3031

3132
## Container and presentation patterns
3233

@@ -469,21 +470,21 @@ We can create an error boundary using a class component, and define lifecycle me
469470
```tsx
470471
class ErrorBoundary extends React.Component {
471472
constructor(props) {
472-
super(props;
473+
super(props);
473474
this.state = { hasError: false };
474475
}
475476

476-
static getDerivedStateFromError {
477+
static getDerivedStateFromError(error) {
477478
return { hasError: true };
478479
}
479480

480481
componentDidCatch(error, errorInfo) {
481-
console.log(error, errorInfo);
482+
console.error("Uncaught error:", error, errorInfo);
482483
}
483484

484485
render() {
485486
if (this.state.hasError) {
486-
return <h1>Something went wrong</h1>;
487+
return <h1>Something went wrong.</h1>;
487488
}
488489
return this.props.children;
489490
}
@@ -606,6 +607,40 @@ I'd like to share some quick insights on memoization patterns in React: `React.m
606607
607608
Here, `handleClick` is memoized, and thus it won't be re-created every render. These memoization patterns will be useful for optimal performance during complex UI interaction and while working with large sets of data.
608609
610+
### Data Fetching with React Server Components (RSC)
611+
612+
A major evolution in React is the introduction of React Server Components (RSC). Unlike the traditional client-side data fetching patterns we've discussed (like using `useEffect` in a Container Component or a custom Hook), Server Components run exclusively on the server.
613+
614+
This allows them to directly access server-side resources like databases or internal APIs without needing to expose an API endpoint to the client. This pattern simplifies data fetching, reduces the amount of JavaScript sent to the browser, and can significantly improve initial page load performance.
615+
616+
A simple example might look like this:
617+
618+
```jsx
619+
// app/some-page/page.js
620+
621+
// This is a Server Component, so we can use async/await directly!
622+
async function getCharacters() {
623+
const res = await fetch("https://your-internal-api/characters", {
624+
cache: "no-store", // Example of fetch options
625+
});
626+
return res.json();
627+
}
628+
629+
export default async function CharactersPage() {
630+
const characters = await getCharacters();
631+
632+
return (
633+
<ul>
634+
{characters.map((char) => (
635+
<li key={char.id}>{char.name}</li>
636+
))}
637+
</ul>
638+
);
639+
}
640+
```
641+
642+
In this pattern, the data fetching and rendering happen on the server. The client receives simple HTML, resulting in a faster and more efficient user experience, especially for content-heavy pages. This pattern co-exists with client components, which still handle interactivity and state using hooks like `useState` and `useEffect`.
643+
609644
# Conclusion
610645
611646
We discussed React design patterns in this article, including Higher-Order Components, Container-Presentational Component Patterns, Compound Components, Controlled Components, and many more. You can enhance code quality, promote team collaboration, and make your apps more scalable, flexible, and maintainable by incorporating these design patterns and best practices into your React projects.
Lines changed: 155 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,155 @@
1+
---
2+
title: Does My Code Dream of Electric Bugs?
3+
description: A reflective deep-dive into the surreal, uncanny relationship between AI, bugs, and human intention in software development.
4+
slug: code-electric-bugs
5+
authors: ozgur
6+
tags: [ai, software, bugs, philosophy, devlife]
7+
image: https://refine.ams3.cdn.digitaloceanspaces.com/blog/2025-07-28-electric-bugs/Frame%2019%20from%20Figma%202.png
8+
hide_table_of_contents: false
9+
---
10+
11+
# Table of Contents
12+
13+
- [Introduction](#introduction)
14+
- [The Phantom in the Stack](#the-phantom-in-the-stack)
15+
- [Bugs: The Original AI Haunting](#bugs-the-original-ai-haunting)
16+
- [Code That Writes Code](#code-that-writes-code)
17+
- [Dreaming in Stack Traces](#dreaming-in-stack-traces)
18+
- [When the AI Gets It Wrong](#when-the-ai-gets-it-wrong)
19+
- [Are These Bugs or Features of the Machine Mind?](#are-these-bugs-or-features-of-the-machine-mind)
20+
- [Debugging the Uncanny](#debugging-the-uncanny)
21+
- [The Role of Human Intent](#the-role-of-human-intent)
22+
- [A Future Without Bugs?](#a-future-without-bugs)
23+
- [Conclusion: The Bug Is the Point](#conclusion-the-bug-is-the-point)
24+
25+
---
26+
27+
# Introduction
28+
29+
Lately, I’ve been wondering if my code dreams at night. If, while I’m away from the keyboard, the bits and branches twist themselves into little narratives—plotlines of logic and misfires. When I return in the morning, there it is: a rogue line of state mutation, an infinite loop where there wasn’t one before, a dropdown that renders sideways in Safari only.
30+
31+
And I wonder: _was this my bug… or the machine’s dream?_
32+
33+
We’re deep into the era of AI-assisted coding. Co-pilots, agents, GPTs, fuzzy logic linters. Our tools help us write more code, faster. They suggest. They refactor. They create entire modules from prompts. But sometimes — often — they introduce something unintended. A tiny fracture in logic. A syntactic specter.
34+
35+
And we call it a “bug.”
36+
37+
But maybe, just maybe, that bug is more than a mistake. Maybe it’s a glimpse into how machines think.
38+
39+
# The Phantom in the Stack
40+
41+
Even before AI wrote code, software bugs had a kind of haunted quality.
42+
43+
You’ve felt it. That moment when everything compiles, all tests pass — and yet, something’s off. A delay. A missing record. An interaction that should happen, but doesn’t. The phantom bug.
44+
45+
Bugs are human, we tell ourselves. We wrote them. We own them. But they resist us. They hide, they mutate. The moment you try to observe them, they change shape. Schrödinger’s loop.
46+
47+
Now imagine layering an AI on top of that stack. A tool trained on billions of lines of code, capable of writing new logic faster than we can type — and just as capable of introducing subtle, hard-to-track anomalies.
48+
49+
Are we debugging code anymore, or debugging thought?
50+
51+
# Bugs: The Original AI Haunting
52+
53+
The term "bug" predates digital computing. Grace Hopper famously documented the first literal bug — a moth caught in the relays of the Harvard Mark II computer in 1947. But long before that, mechanical failures were blamed on “gremlins” or “ghosts in the machine.”
54+
55+
We’ve always seen software errors as something uncanny. More than just typos or oversights — bugs are expressive. Sometimes humorous. Sometimes poetic. They represent failure, yes, but also unexpected behavior — deviations from intent.
56+
57+
In a way, bugs were the first signs that computers weren’t just calculators. They were systems. Ecosystems. Environments with their own rules and responses.
58+
59+
And now, as AI starts to write more of our code, that expressiveness takes on a new dimension.
60+
61+
# Code That Writes Code
62+
63+
The line between "developer" and "tool" is blurring fast.
64+
65+
Where we once hand-wrote every line, we now guide our agents. We describe what we want. We prompt. We curate. AI tools respond with code — sometimes instantly, sometimes poetically wrong.
66+
67+
AI doesn’t just autocomplete your line anymore — it scaffolds your app, fetches your data, generates your backend, and tests it too. In this ecosystem, the human becomes more of a composer than a technician.
68+
69+
But here's the twist: AI doesn’t _understand_ bugs the way we do. It doesn’t fear them. It doesn’t anticipate them. It doesn’t know what it means to “break production” or “ruin someone’s day.”
70+
71+
So when an AI agent introduces a subtle logic error, it’s not because it’s careless. It’s because, to it, the concept of “wrong” is statistical — not emotional.
72+
73+
To us, bugs are mistakes. To an AI, they’re possibilities.
74+
75+
# Dreaming in Stack Traces
76+
77+
There’s something beautiful about reading a stack trace. It’s a map of dreams gone wrong.
78+
79+
This function called that one. That one hit a null. The null had been seeded hours earlier by a subtle mismatch in types — an AI-generated type, no less, that looked _right_ until it wasn’t.
80+
81+
In the age of AI, stack traces are turning into machine-generated poetry. Here’s a line the model thought was helpful. Here’s a suggestion it made at 3AM. Here’s an entire function wrapped in a try/catch with an empty catch block. Why? No one knows.
82+
83+
But the trail is there. You follow it not just to fix the bug, but to _understand the machine’s dream logic_.
84+
85+
# When the AI Gets It Wrong
86+
87+
Sometimes the AI gets it spectacularly wrong.
88+
89+
You ask for a CRUD app with authentication. It gives you a perfectly scaffolded UI — but forgets to hash passwords. Or it pulls in a deprecated library. Or wires up your state with two incompatible paradigms: Redux and Zustand living side-by-side like uneasy roommates.
90+
91+
These aren’t just errors. They’re _insights_. They tell us what the AI knows — and doesn’t. They reveal the boundaries of its training, the assumptions it’s making, the shortcuts it’s learned from the web.
92+
93+
They also force us to ask: _How much of this code did I write?_ If 80% came from a prompt, and I only tweaked it, who’s responsible for the bug?
94+
95+
Is this my bug, or the model’s hallucination?
96+
97+
# Are These Bugs or Features of the Machine Mind?
98+
99+
In Philip K. Dick’s “Do Androids Dream of Electric Sheep?” — the inspiration behind Blade Runner — androids don’t just malfunction. They reveal who we are. The same is becoming true of AI-generated code.
100+
101+
The bugs it creates aren’t always “wrong.” Sometimes they’re just… different. Optimized for readability instead of performance. Favoring one pattern over another because it saw it more often in the training set. Making decisions based on patterns, not purposes.
102+
103+
These aren’t bugs in the traditional sense. They’re expressions of how the model thinks.
104+
105+
And that’s both exciting and a little terrifying.
106+
107+
# Debugging the Uncanny
108+
109+
The AI assistant has no fear of prod. It doesn’t know the panic of a broken checkout page or the shame of a failed deploy. It doesn’t “debug” the way we do.
110+
111+
So debugging AI-written code feels like translating dreams into facts. You’re not just fixing logic — you’re reverse-engineering intent.
112+
113+
What _was_ the model trying to do when it wrapped that mutation inside a timeout? Why did it call that endpoint twice? Did it misunderstand the spec — or is this a glimpse into a logic that’s not quite human?
114+
115+
The uncanny valley exists in code, too.
116+
117+
# The Role of Human Intent
118+
119+
Despite all this — or maybe because of it — our role as developers becomes even more critical.
120+
121+
The AI can generate code, but it can’t choose the _why_. It can scaffold your app, but it can’t understand your business logic, your team dynamics, your regulatory context, your aesthetic choices.
122+
123+
It can dream. But only we can decide which dreams are worth building.
124+
125+
And perhaps more importantly: only we can wake up and say, _that’s not right_.
126+
127+
# A Future Without Bugs?
128+
129+
Some believe AI will eventually eliminate bugs altogether.
130+
131+
Smarter models. More testing. Better formal verification. Code that corrects itself in real time.
132+
133+
But I’m not so sure.
134+
135+
Bugs are expressions of complexity. As long as we’re building systems that interact with people, data, and time — there will be friction. Unexpected inputs. Edge cases. Moments where two correct things combine into something broken.
136+
137+
Even the best AI won’t prevent that. Because bugs aren’t just mistakes. They’re part of how we learn, how we grow, how we _see the edges of the system_.
138+
139+
# Conclusion: The Bug Is the Point
140+
141+
So… does my code dream of electric bugs?
142+
143+
Yes. Absolutely. And so does yours.
144+
145+
Because bugs are where the real magic happens. They’re the shadows that show us where the logic bends. The smoke that hints at hidden fire. The flicker of mystery in a system we thought we understood.
146+
147+
In an age of AI-generated code, bugs aren’t going away. If anything, they’re becoming _stranger_. More abstract. More reflective of how machines think.
148+
149+
But that’s okay.
150+
151+
Because debugging isn’t just about fixing errors. It’s about interpretation. It’s about storytelling. It’s about asking: _What was this code trying to be?_
152+
153+
And maybe — just maybe — it's about waking up from a machine’s dream, and deciding what parts of it we want to keep.
154+
155+
---

documentation/docs/audit-logs/hooks/use-log/index.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,9 @@ mutate({
5757

5858
### Return value
5959

60-
| Description | Type |
61-
| ----------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------- |
62-
| Result of the `react-query`'s useMutation | [`UseMutationResult<{ data: TData}, TError, { id: BaseKey; name: string; }, unknown>`](https://react-query.tanstack.com/reference/useMutation) |
60+
| Description | Type |
61+
| ----------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------- |
62+
| Result of the `react-query`'s useMutation | [`UseMutationResult<{ data: TData}, TError, { id: BaseKey; name: string; }, unknown>`](https://tanstack.com/query/v4/docs/framework/react/reference/useMutation) |
6363

6464
## rename
6565

@@ -94,6 +94,6 @@ mutate({
9494

9595
### Return value
9696

97-
| Description | Type |
98-
| ----------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------- |
99-
| Result of the `react-query`'s useMutation | [`UseMutationResult<{ data: TData}, TError, { id: BaseKey; name: string; }, unknown>`](https://react-query.tanstack.com/reference/useMutation) |
97+
| Description | Type |
98+
| ----------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------- |
99+
| Result of the `react-query`'s useMutation | [`UseMutationResult<{ data: TData}, TError, { id: BaseKey; name: string; }, unknown>`](https://tanstack.com/query/v4/docs/framework/react/reference/useMutation) |

documentation/docs/authentication/hooks/use-forgot-password/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ source: /packages/core/src/hooks/auth/useForgotPassword/index.ts
66

77
`useForgotPassword` calls the `forgotPassword` method from [`authProvider`](/docs/authentication/auth-provider) under the hood.
88

9-
It returns the result of `react-query`'s [useMutation](https://react-query.tanstack.com/reference/useMutation) which includes many properties, some of which being `isSuccess` and `isError`.
9+
It returns the result of `react-query`'s [useMutation](https://tanstack.com/query/v4/docs/framework/react/reference/useMutation) which includes many properties, some of which being `isSuccess` and `isError`.
1010

1111
Data that is resolved from `forgotPassword` will be returned as the `data` in the query result with the following type:
1212

documentation/docs/authentication/hooks/use-login/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ source: /packages/core/src/hooks/auth/useLogin/index.ts
66

77
`useLogin` calls `login` method from [`authProvider`](/docs/authentication/auth-provider) under the hood.
88

9-
It returns the result of `react-query`'s [useMutation](https://react-query.tanstack.com/reference/useMutation) which includes many properties, some of which being `isSuccess` and `isError`.
9+
It returns the result of `react-query`'s [useMutation](https://tanstack.com/query/v4/docs/framework/react/reference/useMutation) which includes many properties, some of which being `isSuccess` and `isError`.
1010

1111
Data that is resolved from `login` will be returned as the `data` in the query result with the following type:
1212

documentation/docs/authentication/hooks/use-logout/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ source: /packages/core/src/hooks/auth/useLogout/index.ts
66

77
`useLogout` calls the `logout` method from the [`authProvider`](/docs/authentication/auth-provider) under the hood.
88

9-
It returns the result of `react-query`'s [useMutation](https://react-query.tanstack.com/reference/useMutation) which includes many properties, some of which being `isSuccess` and `isError`.
9+
It returns the result of `react-query`'s [useMutation](https://tanstack.com/query/v4/docs/framework/react/reference/useMutation) which includes many properties, some of which being `isSuccess` and `isError`.
1010

1111
Data that is resolved from `logout` will be returned as the `data` in the query result with the following type:
1212

documentation/docs/authentication/hooks/use-register/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ source: /packages/core/src/hooks/auth/useRegister/index.ts
66

77
`useRegister` calls `register` method from [`authProvider`](/docs/authentication/auth-provider) under the hood.
88

9-
It returns the result of `react-query`'s [useMutation](https://react-query.tanstack.com/reference/useMutation) which includes many properties, some of which being isSuccess and isError.
9+
It returns the result of `react-query`'s [useMutation](https://tanstack.com/query/v4/docs/framework/react/reference/useMutation) which includes many properties, some of which being isSuccess and isError.
1010

1111
Data that is resolved from `register` will be returned as the `data` in the query result with the following type:
1212

documentation/docs/authentication/hooks/use-update-password/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ source: /packages/core/src/hooks/auth/useUpdatePassword/index.ts
66

77
`useUpdatePassword` calls `updatePassword` method from [`authProvider`](/docs/authentication/auth-provider) under the hood.
88

9-
It returns the result of `react-query`'s [useMutation](https://react-query.tanstack.com/reference/useMutation).
9+
It returns the result of `react-query`'s [useMutation](https://tanstack.com/query/v4/docs/framework/react/reference/useMutation).
1010

1111
Data that is resolved from `updatePassword` will be returned as the `data` in the query result with the following type:
1212

0 commit comments

Comments
 (0)