Skip to content

Commit 2559889

Browse files
committed
Merge branch 'issue-220' of github.com:hyperstack-org/hyperstack into issue-220
2 parents 037e8dd + 7d7c19e commit 2559889

File tree

3 files changed

+23
-2
lines changed

3 files changed

+23
-2
lines changed

ruby/hyper-component/lib/hyperstack/component/while_loading.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ def resources_loaded?
1616
if Hyperstack::Component::IsomorphicHelpers.on_opal_client?
1717
%x{
1818
function onError(event) {
19-
if (event.message.startsWith('Uncaught NotQuiet: ')) event.preventDefault();
19+
if (event.message.match(/^Uncaught NotQuiet: /)) event.preventDefault();
2020
}
2121
2222
window.addEventListener('error', onError);

ruby/hyper-component/lib/hyperstack/internal/component/react_wrapper.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ def self.create_native_react_class(type)
109109
this.__opalInstanceSyncSetState = false;
110110
}
111111
},
112-
shouldComponentUpdate(next_props, next_state) {
112+
shouldComponentUpdate: function(next_props, next_state) {
113113
if (#{type.method_defined? :should_component_update?}) {
114114
this.__opalInstanceSyncSetState = false;
115115
return this.__opalInstance["$should_component_update?"](Opal.Hash.$new(next_props), Opal.Hash.$new(next_state));

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

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -478,6 +478,27 @@ def component_did_update(*args)
478478
reactive_record_link_set_while_loading_container_class
479479
end
480480

481+
# This is required to support legacy browsers (Internet Explorer 9+)
482+
# https://developer.mozilla.org/en-US/docs/Web/API/Element/closest#Polyfill
483+
`
484+
if (!Element.prototype.matches) {
485+
Element.prototype.matches = Element.prototype.msMatchesSelector ||
486+
Element.prototype.webkitMatchesSelector;
487+
}
488+
489+
if (!Element.prototype.closest) {
490+
Element.prototype.closest = function(s) {
491+
var el = this;
492+
493+
do {
494+
if (el.matches(s)) return el;
495+
el = el.parentElement || el.parentNode;
496+
} while (el !== null && el.nodeType === 1);
497+
return null;
498+
};
499+
}
500+
`
501+
481502
def reactive_record_link_to_enclosing_while_loading_container
482503
# Call after any component mounts - attaches the containers loading id to this component
483504
# Fyi, the while_loading container is responsible for setting its own link to itself

0 commit comments

Comments
 (0)