Skip to content

Commit 59f1e68

Browse files
committed
Fixes server rendering with polyfill
Caused by issue: reduxjs/redux#1335
1 parent ea16151 commit 59f1e68

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

lib/react_on_rails/server_rendering_pool.rb

+13
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ def create_js_context
7575
bundle_js_code = File.read(server_js_file)
7676
base_js_code = <<-JS
7777
#{console_polyfill}
78+
#{execjs_timer_polyfills}
7879
#{bundle_js_code};
7980
JS
8081
begin
@@ -102,6 +103,18 @@ def create_js_context
102103
end
103104
end
104105

106+
def execjs_timer_polyfills
107+
<<-JS
108+
function setInterval() {
109+
conosle.error('setInterval is not defined for execJS. See https://github.com/sstephenson/execjs#faq');
110+
}
111+
112+
function setTimeout() {
113+
conosle.error('setTimeout is not defined for execJS. See https://github.com/sstephenson/execjs#faq');
114+
}
115+
JS
116+
end
117+
105118
# Reimplement console methods for replaying on the client
106119
def console_polyfill
107120
<<-JS

0 commit comments

Comments
 (0)