Skip to content

Commit

Permalink
fix(BUN-2085): nit in variable definition (#954)
Browse files Browse the repository at this point in the history
  • Loading branch information
bc-victor authored Mar 4, 2024
1 parent 612f8b3 commit f6eb05f
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 11 deletions.
3 changes: 1 addition & 2 deletions apps/storefront/.eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@
"files": [
"src/pages/**/*.{ts,tsx}",
"src/utils/**/*.{ts,tsx}",
"src/components/**/*.{ts,tsx}",
"src/shared/**/**.*ts"
"src/components/**/*.{ts,tsx}"
],
"rules": {
"no-param-reassign": 0
Expand Down
4 changes: 2 additions & 2 deletions apps/storefront/src/hooks/dom/useHideGoogleCustomerReviews.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ const useHideGoogleCustomerReviews = (
const newVisibilityStyle = isOpen ? 'none' : 'inline-block'

googleCustomerReviewsDoms.forEach((dom) => {
const d = dom
if (d?.parentElement) d.parentElement.style.display = newVisibilityStyle
const parentElement = dom?.parentElement
if (parentElement) parentElement.style.display = newVisibilityStyle
})
}, [isOpen])
}
Expand Down
18 changes: 11 additions & 7 deletions apps/storefront/src/shared/dynamicallyVariable/context/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,27 +17,31 @@ export const reducer = (
state: DynamicallyVariableState,
action: Partial<DynamicallyVariableAction>
) => {
const currentAction = action
const setMulTip = () => {
if (action.type === 'tip' && action.payload?.tipMessage) {
if (currentAction.type === 'tip' && currentAction.payload?.tipMessage) {
const msgs = state?.tipMessage?.msgs || []

const {
tipMessage: { msgs: newMsgs = [] },
} = action.payload
} = currentAction.payload

action.payload.tipMessage.msgs = [...msgs, ...newMsgs]
currentAction.payload.tipMessage.msgs = [...msgs, ...newMsgs]

return action.payload
return currentAction.payload
}

if (action.type === 'globalTip' && action.payload?.globalTipMessage) {
if (
currentAction.type === 'globalTip' &&
currentAction.payload?.globalTipMessage
) {
const msgs = state?.globalTipMessage?.msgs || []

const {
globalTipMessage: { msgs: newMsgs = [] },
} = action.payload
} = currentAction.payload

action.payload.globalTipMessage.msgs = [...msgs, ...newMsgs]
currentAction.payload.globalTipMessage.msgs = [...msgs, ...newMsgs]

return action.payload
}
Expand Down

0 comments on commit f6eb05f

Please sign in to comment.