Skip to content

Commit 60a9abf

Browse files
committed
Update deps & update useFlash
1 parent de6b96e commit 60a9abf

5 files changed

Lines changed: 168 additions & 240 deletions

File tree

Gemfile.lock

Lines changed: 57 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -3,66 +3,66 @@ GEM
33
specs:
44
action_text-trix (2.1.16)
55
railties
6-
actioncable (8.1.1)
7-
actionpack (= 8.1.1)
8-
activesupport (= 8.1.1)
6+
actioncable (8.1.2)
7+
actionpack (= 8.1.2)
8+
activesupport (= 8.1.2)
99
nio4r (~> 2.0)
1010
websocket-driver (>= 0.6.1)
1111
zeitwerk (~> 2.6)
12-
actionmailbox (8.1.1)
13-
actionpack (= 8.1.1)
14-
activejob (= 8.1.1)
15-
activerecord (= 8.1.1)
16-
activestorage (= 8.1.1)
17-
activesupport (= 8.1.1)
12+
actionmailbox (8.1.2)
13+
actionpack (= 8.1.2)
14+
activejob (= 8.1.2)
15+
activerecord (= 8.1.2)
16+
activestorage (= 8.1.2)
17+
activesupport (= 8.1.2)
1818
mail (>= 2.8.0)
19-
actionmailer (8.1.1)
20-
actionpack (= 8.1.1)
21-
actionview (= 8.1.1)
22-
activejob (= 8.1.1)
23-
activesupport (= 8.1.1)
19+
actionmailer (8.1.2)
20+
actionpack (= 8.1.2)
21+
actionview (= 8.1.2)
22+
activejob (= 8.1.2)
23+
activesupport (= 8.1.2)
2424
mail (>= 2.8.0)
2525
rails-dom-testing (~> 2.2)
26-
actionpack (8.1.1)
27-
actionview (= 8.1.1)
28-
activesupport (= 8.1.1)
26+
actionpack (8.1.2)
27+
actionview (= 8.1.2)
28+
activesupport (= 8.1.2)
2929
nokogiri (>= 1.8.5)
3030
rack (>= 2.2.4)
3131
rack-session (>= 1.0.1)
3232
rack-test (>= 0.6.3)
3333
rails-dom-testing (~> 2.2)
3434
rails-html-sanitizer (~> 1.6)
3535
useragent (~> 0.16)
36-
actiontext (8.1.1)
36+
actiontext (8.1.2)
3737
action_text-trix (~> 2.1.15)
38-
actionpack (= 8.1.1)
39-
activerecord (= 8.1.1)
40-
activestorage (= 8.1.1)
41-
activesupport (= 8.1.1)
38+
actionpack (= 8.1.2)
39+
activerecord (= 8.1.2)
40+
activestorage (= 8.1.2)
41+
activesupport (= 8.1.2)
4242
globalid (>= 0.6.0)
4343
nokogiri (>= 1.8.5)
44-
actionview (8.1.1)
45-
activesupport (= 8.1.1)
44+
actionview (8.1.2)
45+
activesupport (= 8.1.2)
4646
builder (~> 3.1)
4747
erubi (~> 1.11)
4848
rails-dom-testing (~> 2.2)
4949
rails-html-sanitizer (~> 1.6)
50-
activejob (8.1.1)
51-
activesupport (= 8.1.1)
50+
activejob (8.1.2)
51+
activesupport (= 8.1.2)
5252
globalid (>= 0.3.6)
53-
activemodel (8.1.1)
54-
activesupport (= 8.1.1)
55-
activerecord (8.1.1)
56-
activemodel (= 8.1.1)
57-
activesupport (= 8.1.1)
53+
activemodel (8.1.2)
54+
activesupport (= 8.1.2)
55+
activerecord (8.1.2)
56+
activemodel (= 8.1.2)
57+
activesupport (= 8.1.2)
5858
timeout (>= 0.4.0)
59-
activestorage (8.1.1)
60-
actionpack (= 8.1.1)
61-
activejob (= 8.1.1)
62-
activerecord (= 8.1.1)
63-
activesupport (= 8.1.1)
59+
activestorage (8.1.2)
60+
actionpack (= 8.1.2)
61+
activejob (= 8.1.2)
62+
activerecord (= 8.1.2)
63+
activesupport (= 8.1.2)
6464
marcel (~> 1.0)
65-
activesupport (8.1.1)
65+
activesupport (8.1.2)
6666
base64
6767
bigdecimal
6868
concurrent-ruby (~> 1.0, >= 1.3.1)
@@ -117,7 +117,7 @@ GEM
117117
diff-lcs (1.6.2)
118118
dotenv (3.2.0)
119119
drb (2.2.3)
120-
dry-cli (1.3.0)
120+
dry-cli (1.4.0)
121121
ed25519 (1.4.0)
122122
erb (6.0.1)
123123
erubi (1.13.1)
@@ -245,30 +245,30 @@ GEM
245245
rack (>= 1.3)
246246
rackup (2.3.1)
247247
rack (>= 3)
248-
rails (8.1.1)
249-
actioncable (= 8.1.1)
250-
actionmailbox (= 8.1.1)
251-
actionmailer (= 8.1.1)
252-
actionpack (= 8.1.1)
253-
actiontext (= 8.1.1)
254-
actionview (= 8.1.1)
255-
activejob (= 8.1.1)
256-
activemodel (= 8.1.1)
257-
activerecord (= 8.1.1)
258-
activestorage (= 8.1.1)
259-
activesupport (= 8.1.1)
248+
rails (8.1.2)
249+
actioncable (= 8.1.2)
250+
actionmailbox (= 8.1.2)
251+
actionmailer (= 8.1.2)
252+
actionpack (= 8.1.2)
253+
actiontext (= 8.1.2)
254+
actionview (= 8.1.2)
255+
activejob (= 8.1.2)
256+
activemodel (= 8.1.2)
257+
activerecord (= 8.1.2)
258+
activestorage (= 8.1.2)
259+
activesupport (= 8.1.2)
260260
bundler (>= 1.15.0)
261-
railties (= 8.1.1)
261+
railties (= 8.1.2)
262262
rails-dom-testing (2.3.0)
263263
activesupport (>= 5.0.0)
264264
minitest
265265
nokogiri (>= 1.6)
266266
rails-html-sanitizer (1.6.2)
267267
loofah (~> 2.21)
268268
nokogiri (>= 1.15.7, != 1.16.7, != 1.16.6, != 1.16.5, != 1.16.4, != 1.16.3, != 1.16.2, != 1.16.1, != 1.16.0.rc1, != 1.16.0)
269-
railties (8.1.1)
270-
actionpack (= 8.1.1)
271-
activesupport (= 8.1.1)
269+
railties (8.1.2)
270+
actionpack (= 8.1.2)
271+
activesupport (= 8.1.2)
272272
irb (~> 1.13)
273273
rackup (>= 1.0.0)
274274
rake (>= 12.2)
@@ -349,14 +349,14 @@ GEM
349349
activejob (>= 7.2)
350350
activerecord (>= 7.2)
351351
railties (>= 7.2)
352-
solid_queue (1.2.4)
352+
solid_queue (1.3.0)
353353
activejob (>= 7.1)
354354
activerecord (>= 7.1)
355355
concurrent-ruby (>= 1.3.1)
356356
fugit (~> 1.11)
357357
railties (>= 7.1)
358358
thor (>= 1.3.1)
359-
sorbet-runtime (0.6.12873)
359+
sorbet-runtime (0.6.12883)
360360
sqlite3 (2.9.0-aarch64-linux-gnu)
361361
sqlite3 (2.9.0-aarch64-linux-musl)
362362
sqlite3 (2.9.0-arm-linux-gnu)
@@ -372,7 +372,7 @@ GEM
372372
net-ssh (>= 2.8.0)
373373
ostruct
374374
stringio (3.2.0)
375-
thor (1.4.0)
375+
thor (1.5.0)
376376
thruster (0.1.17)
377377
thruster (0.1.17-aarch64-linux)
378378
thruster (0.1.17-arm64-darwin)

app/frontend/hooks/use-flash.tsx

Lines changed: 7 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,20 @@
1-
import { router, usePage } from "@inertiajs/react"
2-
import { useEffect, useRef } from "react"
1+
import { usePage } from "@inertiajs/react"
2+
import { useEffect } from "react"
33
import { toast } from "sonner"
44

55
import type { FlashData } from "@/types"
66

77
function showFlash(flash: FlashData) {
8-
if (flash.alert) {
9-
toast.error(flash.alert)
10-
}
11-
if (flash.notice) {
12-
toast(flash.notice)
13-
}
8+
if (flash.alert) toast.error(flash.alert)
9+
if (flash.notice) toast(flash.notice)
1410
}
1511

1612
export function useFlash() {
1713
const { flash } = usePage()
18-
const toastShowed = useRef(false)
1914

2015
useEffect(() => {
21-
if (!toastShowed.current) {
22-
toastShowed.current = true
23-
showFlash(flash)
24-
}
16+
// setTimeout + cleanup prevents double-firing in React StrictMode
17+
const timeout = setTimeout(() => showFlash(flash), 0)
18+
return () => clearTimeout(timeout)
2519
}, [flash])
26-
27-
useEffect(() => {
28-
return router.on("flash", (event) => {
29-
const flash = event.detail.flash
30-
showFlash(flash)
31-
})
32-
}, [])
3320
}

app/frontend/routes/index.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* @file Generated by js-routes 2.3.6. Based on Rails 8.1.1 routes of ReactStarterKit::Application.
2+
* @file Generated by js-routes 2.3.6. Based on Rails 8.1.2 routes of ReactStarterKit::Application.
33
* @version 743c630cafd479b5d9ad42a7803e8be1fdeb9448419ce21d215b267e2b0ae749
44
* @see https://github.com/railsware/js-routes
55
*/

app/frontend/routes/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* @file Generated by js-routes 2.3.6. Based on Rails 8.1.1 routes of ReactStarterKit::Application.
2+
* @file Generated by js-routes 2.3.6. Based on Rails 8.1.2 routes of ReactStarterKit::Application.
33
* @version 743c630cafd479b5d9ad42a7803e8be1fdeb9448419ce21d215b267e2b0ae749
44
* @see https://github.com/railsware/js-routes
55
*/

0 commit comments

Comments
 (0)