File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -2,7 +2,6 @@ import React from 'react';
22import PropTypes from 'prop-types' ;
33import Immutable from 'immutable' ;
44import _ from 'lodash' ;
5- import * as ActionCable from '@rails/actioncable' ;
65import { injectIntl } from 'react-intl' ;
76import BaseComponent from 'libs/components/BaseComponent' ;
87import actionCableUrl from 'libs/actionCableUrl' ;
@@ -36,6 +35,11 @@ class CommentBox extends BaseComponent {
3635
3736 subscribeChannel ( ) {
3837 const { messageReceived } = this . props . actions ;
38+
39+ // Avoid loading ActionCable during server-side rendering.
40+ // eslint-disable-next-line global-require
41+ const actionCableModule = require ( '@rails/actioncable' ) ;
42+ const ActionCable = actionCableModule . default || actionCableModule ;
3943 this . cable = ActionCable . createConsumer ( actionCableUrl ( ) ) ;
4044
4145 /* eslint no-console: ["error", { allow: ["log"] }] */
@@ -62,7 +66,7 @@ class CommentBox extends BaseComponent {
6266 }
6367
6468 componentWillUnmount ( ) {
65- this . cable . subscriptions . remove ( { channel : 'CommentsChannel' } ) ;
69+ this . cable ? .subscriptions . remove ( { channel : 'CommentsChannel' } ) ;
6670 }
6771
6872 refreshComments ( ) {
Original file line number Diff line number Diff line change @@ -9,9 +9,9 @@ module TutorialCI
99 "Build: Test assets" ,
1010 "RAILS_ENV=test bin/conductor-exec bin/rails react_on_rails:generate_packs && " \
1111 "bin/conductor-exec yarn res:build && " \
12- "bin/conductor-exec yarn build:test" ,
12+ "bin/conductor-exec yarn build:test"
1313 ] ,
1414 [ "Tests: RSpec" , "bin/conductor-exec bin/rspec" ] ,
15- [ "Tests: Jest" , "bin/conductor-exec yarn test:client" ] ,
15+ [ "Tests: Jest" , "bin/conductor-exec yarn test:client" ]
1616 ] . freeze
1717end
Original file line number Diff line number Diff line change 9393 # config.host_authorization = { exclude: ->(request) { request.path == "/up" } }
9494
9595 # Action Cable endpoint configuration
96- production_host = ENV [ "PRODUCTION_HOST" ]
96+ production_host = ENV . fetch ( "PRODUCTION_HOST" , nil )
9797 if production_host . present?
9898 config . action_cable . url = "wss://#{ production_host } /cable"
9999 config . action_cable . allowed_request_origins = [ "https://#{ production_host } " ]
You can’t perform that action at this time.
0 commit comments