Skip to content

Commit 81d89a9

Browse files
committed
fixed options hash manipulation causing issues discovered while migrating matestack-ui-bootstrap to 2.0
1 parent 3a51fff commit 81d89a9

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

lib/matestack/ui/core/base.rb

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,14 @@ def initialize(html_tag = nil, text = nil, options = {}, &block)
2929
# check if text is given and set text and options accordingly
3030
def extract_options(text, options)
3131
if text.is_a? Hash
32-
self.options = text
32+
# we need to dup the text object because we're deleting keys from this object which manipulates the object passed in here
33+
# if this object is reused after beeing injected into this component, the keys would be missing
34+
self.options = text.dup
3335
else
3436
self.text = text
35-
self.options = options || {}
37+
# we need to dup the options object because we're deleting keys from this object which manipulates the object passed in here
38+
# if this object is reused after beeing injected into this component, the keys would be missing
39+
self.options = options.dup || {}
3640
end
3741
self.options.symbolize_keys!
3842
end

0 commit comments

Comments
 (0)