phlex-reactive 0.4.6 → 0.4.7
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/CHANGELOG.md +21 -0
- data/app/javascript/phlex/reactive/reactive_controller.js +11 -1
- data/lib/phlex/reactive/engine.rb +7 -2
- data/lib/phlex/reactive/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 6a9dfa70408b2db2a88337edfc41963ead03b74cd83d919888b9e3b9bbf5eb99
|
|
4
|
+
data.tar.gz: 3adb9e76db58f23fd80ebbbc9cb50b08768bbf3473ee5f83375d89b781eda454
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 3011d097ec4280eaac80d94d914287d9604a3413615875ac719100065ef20d694ac4025e2695483d782f0c99e5803027dc5d717d38a922f4d404f40d67d513d9
|
|
7
|
+
data.tar.gz: 35b1ec519c60fa7c2a4655b80ad2717d8eca2eb84f71f262ec67ca618b83582acbef81980ceb6125addfb6b47dc9dc5f732170291a507dd2246b1986ddb1097c
|
data/CHANGELOG.md
CHANGED
|
@@ -101,6 +101,27 @@ adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
|
101
101
|
|
|
102
102
|
### Fixed
|
|
103
103
|
|
|
104
|
+
- **`reactive_controller.js` used a relative `./confirm.js` import that 404'd under
|
|
105
|
+
importmap-rails + Propshaft — taking down every Stimulus controller on the page (#57).**
|
|
106
|
+
The #55 confirm resolver added `import { confirmResolver } from "./confirm.js"` to the
|
|
107
|
+
client controller. Under importmap + Propshaft the controller is served at its
|
|
108
|
+
**digested** URL, and a relative sibling import is left untouched (Propshaft's JS
|
|
109
|
+
compiler rewrites only `RAILS_ASSET_URL(...)`, and the import map resolves **only**
|
|
110
|
+
bare specifiers, never relative-resolved URLs). So the browser resolved `./confirm.js`
|
|
111
|
+
against the digested controller URL and requested an **undigested**
|
|
112
|
+
`/assets/phlex/reactive/confirm.js` → **404**. The throwing import meant
|
|
113
|
+
`reactive_controller.js` never evaluated, and in an app that eagerly registers it the
|
|
114
|
+
whole controllers entrypoint died — **every** Stimulus controller on the page stopped,
|
|
115
|
+
with no obvious link to phlex-reactive. The fix imports the **bare** specifier the
|
|
116
|
+
engine already pins (`phlex/reactive/confirm`), which resolves to the digested asset
|
|
117
|
+
through the import map and mirrors how the gem already expects apps to import the
|
|
118
|
+
module (`import { setConfirmResolver } from "phlex/reactive/confirm"`). Bundlers
|
|
119
|
+
(esbuild/webpack/bun) resolve the bare specifier the same way they already resolve
|
|
120
|
+
`phlex/reactive/reactive_controller`; the gem's bun JS suite resolves it via a new
|
|
121
|
+
`tsconfig.json` `paths` alias. Covered by a bun unit test (the bare import resolves,
|
|
122
|
+
and the source no longer carries the relative form). 0.4.5 was unaffected (inline
|
|
123
|
+
`window.confirm`, no relative import).
|
|
124
|
+
|
|
104
125
|
- **Client mirror of #44: collections of *reactive* rows were STILL add-once-only in
|
|
105
126
|
the browser — `#extractToken` read the FIRST token in the response, not this
|
|
106
127
|
controller's own (#46).** The server fix in 0.4.2 (#44) made the `add` response
|
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
import { Controller } from "@hotwired/stimulus"
|
|
2
|
-
|
|
2
|
+
// Import the BARE specifier the engine already pins (phlex/reactive/confirm),
|
|
3
|
+
// NOT a relative "./confirm.js" (issue #57). Under importmap-rails + Propshaft
|
|
4
|
+
// the controller is served at its DIGESTED url; a relative sibling import is
|
|
5
|
+
// left untouched (Propshaft rewrites only RAILS_ASSET_URL(...), and the import
|
|
6
|
+
// map resolves ONLY bare specifiers), so "./confirm.js" resolves against the
|
|
7
|
+
// digested controller url → an undigested /assets/.../confirm.js that 404s, and
|
|
8
|
+
// the throwing import takes down every Stimulus controller on the page. The
|
|
9
|
+
// bare specifier resolves to the digested asset through the import map, and
|
|
10
|
+
// bundlers/bun resolve it the same way they already resolve
|
|
11
|
+
// "phlex/reactive/reactive_controller" (see tsconfig.json paths for the tests).
|
|
12
|
+
import { confirmResolver } from "phlex/reactive/confirm"
|
|
3
13
|
|
|
4
14
|
// The ONE generic controller behind every reactive Phlex component. It
|
|
5
15
|
// replaces the per-feature Stimulus controllers you'd otherwise hand-write
|
|
@@ -42,8 +42,13 @@ module Phlex
|
|
|
42
42
|
preload: true
|
|
43
43
|
)
|
|
44
44
|
# The overridable confirm resolver (issue #55). reactive_controller.js
|
|
45
|
-
# imports it
|
|
46
|
-
#
|
|
45
|
+
# imports it by this BARE specifier — `import { confirmResolver } from
|
|
46
|
+
# "phlex/reactive/confirm"` — NOT a relative "./confirm.js" (issue #57:
|
|
47
|
+
# a relative sibling import inside the digested controller resolves to
|
|
48
|
+
# an undigested /assets/.../confirm.js that 404s under Propshaft). This
|
|
49
|
+
# pin maps the bare specifier to the digested asset, so the controller's
|
|
50
|
+
# own import AND an app's `import { setConfirmResolver } from
|
|
51
|
+
# "phlex/reactive/confirm"` both resolve through the import map.
|
|
47
52
|
it.importmap.pin(
|
|
48
53
|
"phlex/reactive/confirm",
|
|
49
54
|
to: "phlex/reactive/confirm.js",
|