react-on-rails 16.3.0-rc.2 → 16.4.0-rc.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.
- package/lib/ComponentRegistry.js +7 -3
- package/lib/StoreRegistry.js +7 -3
- package/package.json +2 -4
package/lib/ComponentRegistry.js
CHANGED
|
@@ -6,13 +6,17 @@ export default {
|
|
|
6
6
|
*/
|
|
7
7
|
register(components) {
|
|
8
8
|
Object.keys(components).forEach((name) => {
|
|
9
|
-
if (registeredComponents.has(name)) {
|
|
10
|
-
console.warn('Called register for component that is already registered', name);
|
|
11
|
-
}
|
|
12
9
|
const component = components[name];
|
|
13
10
|
if (!component) {
|
|
14
11
|
throw new Error(`Called register with null component named ${name}`);
|
|
15
12
|
}
|
|
13
|
+
// Reference comparison lets HMR re-register the same component silently
|
|
14
|
+
// while still catching bugs where different components share a name.
|
|
15
|
+
const existing = registeredComponents.get(name);
|
|
16
|
+
if (existing && existing.component !== component) {
|
|
17
|
+
console.error(`ReactOnRails: Component "${name}" was registered with a different component than previously. ` +
|
|
18
|
+
'This is likely a bug — ensure each component has a unique registration name.');
|
|
19
|
+
}
|
|
16
20
|
const renderFunction = isRenderFunction(component);
|
|
17
21
|
const isRenderer = renderFunction && component.length === 3;
|
|
18
22
|
registeredComponents.set(name, {
|
package/lib/StoreRegistry.js
CHANGED
|
@@ -7,14 +7,18 @@ export default {
|
|
|
7
7
|
*/
|
|
8
8
|
register(storeGenerators) {
|
|
9
9
|
Object.keys(storeGenerators).forEach((name) => {
|
|
10
|
-
if (registeredStoreGenerators.has(name)) {
|
|
11
|
-
console.warn('Called registerStore for store that is already registered', name);
|
|
12
|
-
}
|
|
13
10
|
const store = storeGenerators[name];
|
|
14
11
|
if (!store) {
|
|
15
12
|
throw new Error('Called ReactOnRails.registerStores with a null or undefined as a value ' +
|
|
16
13
|
`for the store generator with key ${name}.`);
|
|
17
14
|
}
|
|
15
|
+
// Reference comparison lets HMR re-register the same store silently
|
|
16
|
+
// while still catching bugs where different stores share a name.
|
|
17
|
+
const existing = registeredStoreGenerators.get(name);
|
|
18
|
+
if (existing && existing !== store) {
|
|
19
|
+
console.error(`ReactOnRails: Store "${name}" was registered with a different store generator than previously. ` +
|
|
20
|
+
'This is likely a bug — ensure each store has a unique registration name.');
|
|
21
|
+
}
|
|
18
22
|
registeredStoreGenerators.set(name, store);
|
|
19
23
|
});
|
|
20
24
|
},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-on-rails",
|
|
3
|
-
"version": "16.
|
|
3
|
+
"version": "16.4.0-rc.0",
|
|
4
4
|
"description": "react-on-rails JavaScript for react_on_rails Ruby gem",
|
|
5
5
|
"main": "lib/ReactOnRails.full.js",
|
|
6
6
|
"type": "module",
|
|
@@ -65,8 +65,6 @@
|
|
|
65
65
|
"build-watch": "pnpm run clean && tsc --watch",
|
|
66
66
|
"clean": "rm -rf ./lib",
|
|
67
67
|
"test": "jest tests",
|
|
68
|
-
"type-check": "tsc --noEmit --noErrorTruncation"
|
|
69
|
-
"yalc:publish": "yalc publish",
|
|
70
|
-
"yalc": "yalc"
|
|
68
|
+
"type-check": "tsc --noEmit --noErrorTruncation"
|
|
71
69
|
}
|
|
72
70
|
}
|