Skip to content

Commit 51eca9e

Browse files
committed
fix(*) Minor refactoring
1 parent 5b7ea58 commit 51eca9e

5 files changed

Lines changed: 6 additions & 6 deletions

File tree

__tests__/hooks/useIntersectionObserver.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ it.each(cases)('%s', (_, Test) => {
169169
* wheel.
170170
*/
171171
act(() => {
172-
root = container.querySelector('#root') || document
172+
root = container.querySelector('#root') ?? document
173173
root.dispatchEvent(new WheelEvent('wheel', { bubbles: true, deltaY: 1 })) // (2)
174174
jest.runOnlyPendingTimers() // (1)
175175
})

__tests__/hooks/useScrollIntoView.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ const createEvent = (type, { button, pointerType, x = 0, y = 0 } = {}) => {
4242
case 'pointerdown':
4343
init.button = button // eslint-disable-line no-fallthrough
4444
case 'pointerup':
45-
init.pointerType = pointerType || init.button === TOUCH_BUTTON_ID ? 'touch' : 'mouse'
45+
init.pointerType = (pointerType ?? init.button === TOUCH_BUTTON_ID) ? 'touch' : 'mouse'
4646
init.screenX = x * TOUCH_SENSITIVITY
4747
init.screenY = y * TOUCH_SENSITIVITY
4848
return new PointerEvent(type, init)

src/components/svg-filters.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ const primitives = {
197197
* Memo: the first primitive doesn't require a `in` prop, as it will default to
198198
* `SourceGraphic` natively.
199199
*/
200-
const Filter = ({ id, name, ...props }) => {
200+
const Filter = ({ name, id = name, ...props }) => {
201201

202202
if (props.in || props.result) {
203203
return primitives[name](props)
@@ -207,7 +207,7 @@ const Filter = ({ id, name, ...props }) => {
207207
? { height: '300%', width: '300%', x: '-100%', y: '-100%' }
208208
: { height: '200%', width: '200%', x: '-50%', y: '-50%' }
209209

210-
return <filter id={id || name} x={x} y={y} width={width} height={height}>{primitives[name](props)}</filter>
210+
return <filter id={id} x={x} y={y} width={width} height={height}>{primitives[name](props)}</filter>
211211
}
212212

213213
Filter.propTypes = {

src/hooks/useSVGMousePosition.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ const useSVGMousePosition = ({
102102
} else if (hasRoot && !root.current) {
103103
return
104104
}
105-
initListener(root.current || target.current, target.current)
105+
initListener(root.current ?? target.current, target.current)
106106
},
107107
[cleanup, hasRoot, initListener, root, target])
108108

src/hooks/useScrollIntoView.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -331,7 +331,7 @@ const useScrollIntoView = ({
331331
setActiveTarget(direction > 0 ? targets.current.length : -1)
332332
state.current.isScrolling = false
333333
}
334-
state.current.cleanup = addEventListeners(root.current = node || document, onScroll, state.current)
334+
state.current.cleanup = addEventListeners(root.current = node ?? document, onScroll, state.current)
335335
},
336336
[
337337
beforeScroll,

0 commit comments

Comments
 (0)