Skip to content
This repository was archived by the owner on Sep 20, 2024. It is now read-only.

Commit 8a0b375

Browse files
Merge branch 'develop' into feat/grid-item
2 parents fb111fd + 5a4f228 commit 8a0b375

File tree

1 file changed

+22
-1
lines changed

1 file changed

+22
-1
lines changed

packages/chakra-ui-core/src/CPopper/CPopper.js

+22-1
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,27 @@ function flipPlacement (placement) {
4242
}
4343
}
4444

45+
/**
46+
* Call _.merge() for each item of `object` array with the corresponding
47+
* item of `source` array
48+
* @param {*} object The destination Modifiers array.
49+
* @param {*} source The source array.
50+
* @returns Returns merged `array`
51+
*/
52+
function mergeModifiers (object, source) {
53+
if (!Array.isArray(object)) throw new Error('`object` must be an array')
54+
55+
const _source = Array.isArray(source) ? source : [source]
56+
57+
object.forEach((o) => {
58+
const { name } = o
59+
const _s = _source.find(s => s.name === name)
60+
if (_s) merge(o, _s)
61+
})
62+
63+
return object
64+
}
65+
4566
/**
4667
* CPopper component
4768
*
@@ -153,7 +174,7 @@ const CPopper = {
153174
return ref
154175
},
155176
computedModifiers () {
156-
return merge([
177+
return mergeModifiers([
157178
this.usePortal && {
158179
name: 'preventOverflow',
159180
options: {

0 commit comments

Comments
 (0)