Skip to content

Commit 67de79f

Browse files
committed
updated readme dont shim 'closest' function on server
1 parent 2559889 commit 67de79f

File tree

2 files changed

+13
-11
lines changed

2 files changed

+13
-11
lines changed

install/readme.md

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -365,11 +365,12 @@ These two files look like this and are placed in the `app/javascript/packs` dire
365365
```javascript
366366
//app/javascript/packs/client_and_server.js
367367
// these packages will be loaded both during prerendering and on the client
368-
React = require('react'); // react-js library
369-
History = require('history'); // react-router history library
370-
ReactRouter = require('react-router'); // react-router js library
371-
ReactRouterDOM = require('react-router-dom'); // react-router DOM interface
372-
ReactRailsUJS = require('react_ujs'); // interface to react-rails
368+
React = require('react'); // react-js library
369+
createReactClass = require('create-react-class'); // backwards compatibility with ECMA5
370+
History = require('history'); // react-router history library
371+
ReactRouter = require('react-router'); // react-router js library
372+
ReactRouterDOM = require('react-router-dom'); // react-router DOM interface
373+
ReactRailsUJS = require('react_ujs'); // interface to react-rails
373374
// to add additional NPM packages call run yarn add package-name@version
374375
// then add the require here.
375376
```
@@ -406,15 +407,16 @@ end
406407

407408
#### Manage the Hyperstack dependencies with yarn
408409

409-
As you can see above the NPM modules that Hyperstack depends on are part of the webpacker manifests.
410-
But by default Hyperstack will pull copies of these packages into the old-school Rails sprockets asset pipeline.
411-
So if you are using Webpacker you need to add the packages using yarn, and then tell Hyperstack not to
412-
include them in the sprockets asset pipeline.
410+
The above changes will pull the necessary NPM modules in as part of the webpacker manifests.
411+
But by default Hyperstack will try to pull copies of these packages from the Hyperstack gem set using the old-school Rails sprockets asset pipeline.
412+
413+
So instead, when using webpacker, you need to add the packages using the `yarn` package manager, and then tell Hyperstack not to include them in the sprockets asset pipeline.
413414

414415
To add the packages using yarn run these commands:
415416

416417
```bash
417418
yarn add react@16
419+
yarn add create-react-class
418420
yarn add react-dom@16
419421
yarn add react-router@^5.0.0
420422
yarn add react-router-dom@^5.0.0

ruby/hyper-model/lib/reactive_record/active_record/reactive_record/while_loading.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -481,12 +481,12 @@ def component_did_update(*args)
481481
# This is required to support legacy browsers (Internet Explorer 9+)
482482
# https://developer.mozilla.org/en-US/docs/Web/API/Element/closest#Polyfill
483483
`
484-
if (!Element.prototype.matches) {
484+
if (typeof(Element) != 'undefined' && !Element.prototype.matches) {
485485
Element.prototype.matches = Element.prototype.msMatchesSelector ||
486486
Element.prototype.webkitMatchesSelector;
487487
}
488488
489-
if (!Element.prototype.closest) {
489+
if (typeof(Element) != 'undefined' && !Element.prototype.closest) {
490490
Element.prototype.closest = function(s) {
491491
var el = this;
492492

0 commit comments

Comments
 (0)