inertia_cable 0.2.2 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +21 -13
- data/lib/inertia_cable/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 1a8763f30ddbc3cc7e0fc2ade8280ca8e9c57bcd09bbc7eeb9ac4417071b1608
|
|
4
|
+
data.tar.gz: b98b8c3d8194fcf5f7cc563e7e7ed82e1e923570f5dda6e7c23803abe1caffb1
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: cf7a607e798158e08e5d84a58b33256471cbff94710625cec8f4bfd55ea53e1b7874376f23e99c46b043a805c9942d5584ab53d2db1af73ed3ffcaec17ee3fea
|
|
7
|
+
data.tar.gz: 35224b191abc4f06d2ae4a726daab3a7f9522a0cefa19244e2bd1fbe0f51dd6936966ce2475f3aedcc49042bd7432561cbc2f155abf00f3ac82538c536eb96ca
|
data/README.md
CHANGED
|
@@ -52,6 +52,14 @@ Optionally run the install generator:
|
|
|
52
52
|
rails generate inertia_cable:install
|
|
53
53
|
```
|
|
54
54
|
|
|
55
|
+
Version 0.3 targets **Inertia.js 3 and React 19**, and ships ES modules only. Applications on Inertia 1 or 2 should stay on `@inertia-cable/react@0.2` until upgrading.
|
|
56
|
+
|
|
57
|
+
### Upgrading from 0.2
|
|
58
|
+
|
|
59
|
+
Upgrade `@inertiajs/react` to `^3.0.0`, React and React DOM to `^19.0.0`, and `inertia_rails` to `~> 3.19` or newer compatible 3.x. Follow the [Inertia Rails v3 upgrade guide](https://inertia-rails.dev/guide/upgrade-guide) for application configuration changes. Then upgrade `inertia_cable` and `@inertia-cable/react` to 0.3.
|
|
60
|
+
|
|
61
|
+
The hook and Ruby broadcast APIs are unchanged. Use ESM `import` statements; CommonJS `require()` is no longer supported. Background refreshes now preserve existing Inertia page validation errors, including reconnect catch-up reloads.
|
|
62
|
+
|
|
55
63
|
## Quick Start
|
|
56
64
|
|
|
57
65
|
### 1. Model — declare what broadcasts
|
|
@@ -515,7 +523,7 @@ InertiaCable.debounce_delay = 0.5 # server-side debounce
|
|
|
515
523
|
|
|
516
524
|
## Security
|
|
517
525
|
|
|
518
|
-
Stream tokens are HMAC-SHA256 signed using `secret_key_base` and verified server-side on subscription. Invalid tokens are rejected.
|
|
526
|
+
Stream tokens are HMAC-SHA256 signed using `secret_key_base` and verified server-side on subscription. Invalid tokens are rejected. Refresh signals carry model metadata and any `extra` fields over the WebSocket; page props are fetched through your controller and its authorization logic on every reload. Direct messages send their `data` payload over the WebSocket without running controller authorization again. Only issue stream tokens to authorized users, and ensure every subscriber is allowed to receive the stream's metadata and direct messages. Token rotation follows `secret_key_base` rotation.
|
|
519
527
|
|
|
520
528
|
---
|
|
521
529
|
|
|
@@ -534,17 +542,9 @@ inertia_cable_stream(@post.board) # ✓ signs gid://app/Board/1
|
|
|
534
542
|
inertia_cable_stream(@post) # ✗ signs gid://app/Post/1
|
|
535
543
|
```
|
|
536
544
|
|
|
537
|
-
###
|
|
545
|
+
### Reloading selected props
|
|
538
546
|
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
```tsx
|
|
542
|
-
// Bad
|
|
543
|
-
useInertiaCable(stream, { only: someCondition ? ['messages'] : undefined })
|
|
544
|
-
|
|
545
|
-
// Good
|
|
546
|
-
useInertiaCable(stream, { ...(someCondition ? { only: ['messages'] } : {}) })
|
|
547
|
-
```
|
|
547
|
+
Pass arrays for `only` and `except`. Omitted or `undefined` filters are safely ignored. Without either filter, refresh signals reload all normally included props.
|
|
548
548
|
|
|
549
549
|
### Server-side debounce not working across processes
|
|
550
550
|
|
|
@@ -560,16 +560,24 @@ config.cache_store = :redis_cache_store, { url: ENV["REDIS_URL"] }
|
|
|
560
560
|
|
|
561
561
|
- Ruby >= 3.1
|
|
562
562
|
- Rails >= 7.0 (ActionCable, ActiveJob, ActiveSupport)
|
|
563
|
-
- Inertia.js
|
|
563
|
+
- Inertia.js 3.x (`@inertiajs/react`) with React and React DOM 19.x
|
|
564
|
+
- `inertia_rails` >= 3.19, < 4 for Inertia.js 3 applications
|
|
565
|
+
- An ESM-capable frontend build setup (such as Vite)
|
|
564
566
|
- ActionCable configured with Redis or SolidCable (production) or async (development)
|
|
565
567
|
|
|
566
568
|
## Development
|
|
567
569
|
|
|
568
570
|
```bash
|
|
569
571
|
bundle install && bundle exec rspec # Ruby specs
|
|
570
|
-
cd frontend
|
|
572
|
+
cd frontend
|
|
573
|
+
npm ci
|
|
574
|
+
npm run typecheck
|
|
575
|
+
npm test
|
|
576
|
+
npm run build
|
|
571
577
|
```
|
|
572
578
|
|
|
579
|
+
The integration app imports the built package through a local file dependency. After building `frontend`, run `npm ci`, `npm run check`, and `npx vite build` in `integration_test`. Rebuild the package after changing its source; use `npm run dev` in `frontend` while developing the example app.
|
|
580
|
+
|
|
573
581
|
## License
|
|
574
582
|
|
|
575
583
|
MIT
|
metadata
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: inertia_cable
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.3.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Cole Robertson
|
|
8
8
|
bindir: bin
|
|
9
9
|
cert_chain: []
|
|
10
|
-
date: 2026-
|
|
10
|
+
date: 2026-09-10 00:00:00.000000000 Z
|
|
11
11
|
dependencies:
|
|
12
12
|
- !ruby/object:Gem::Dependency
|
|
13
13
|
name: actioncable
|