Commit e277287
committed
🎨 refactor: update Prisma singleton pattern to avoid issues with hot reloading
Update the Prisma singleton pattern to use a factory function instead of directly referencing the global object. This change prevents potential issues with hot reloading in development environments by ensuring a new Prisma client instance is created when necessary. The updated code also leverages the globalThis object and conditionally assigns the Prisma client instance to avoid recreating it in production.1 parent 35e8352 commit e277287
1 file changed
Lines changed: 9 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
11 | | - | |
12 | | - | |
13 | | - | |
| 11 | + | |
| 12 | + | |
14 | 13 | | |
15 | | - | |
16 | | - | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
17 | 21 | | |
18 | 22 | | |
19 | 23 | | |
| |||
0 commit comments