Skip to content

Commit

Permalink
fix(checkbox): memory leak
Browse files Browse the repository at this point in the history
  • Loading branch information
07akioni committed Dec 19, 2024
1 parent 312d133 commit c84b2f2
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 12 deletions.
3 changes: 2 additions & 1 deletion src/checkbox/src/CheckMark.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import type { VNode } from 'vue'
import { h } from 'vue'

export default (
export default (): VNode => (
<svg viewBox="0 0 64 64" class="check-icon">
<path d="M50.42,16.76L22.34,39.45l-8.1-11.46c-1.12-1.58-3.3-1.96-4.88-0.84c-1.58,1.12-1.95,3.3-0.84,4.88l10.26,14.51 c0.56,0.79,1.42,1.31,2.38,1.45c0.16,0.02,0.32,0.03,0.48,0.03c0.8,0,1.57-0.27,2.2-0.78l30.99-25.03c1.5-1.21,1.74-3.42,0.52-4.92 C54.13,15.78,51.93,15.55,50.42,16.76z" />
</svg>
Expand Down
21 changes: 11 additions & 10 deletions src/checkbox/src/Checkbox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ import {
} from '../../_utils'
import { checkboxLight } from '../styles'
import { checkboxGroupInjectionKey } from './CheckboxGroup'
import CheckMark from './CheckMark'
import LineMark from './LineMark'
import renderCheckMark from './CheckMark'
import renderLineMark from './LineMark'
import style from './styles/index.cssr'

export const checkboxProps = {
Expand Down Expand Up @@ -246,16 +246,16 @@ export default defineComponent({
colorTableHeader,
colorTableHeaderModal,
colorTableHeaderPopover,
checkMarkColor,
checkMarkColorDisabled,
renderCheckMarkColor,

Check failure on line 249 in src/checkbox/src/Checkbox.tsx

View workflow job for this annotation

GitHub Actions / lint (20)

Property 'renderCheckMarkColor' does not exist on type '{ labelLineHeight: string; fontSizeSmall: string; fontSizeMedium: string; fontSizeLarge: string; borderRadius: string; color: string; colorChecked: string; colorDisabled: string; colorDisabledChecked: string; ... 18 more ...; labelFontWeight: string; }'.
renderCheckMarkColorDisabled,

Check failure on line 250 in src/checkbox/src/Checkbox.tsx

View workflow job for this annotation

GitHub Actions / lint (20)

Property 'renderCheckMarkColorDisabled' does not exist on type '{ labelLineHeight: string; fontSizeSmall: string; fontSizeMedium: string; fontSizeLarge: string; borderRadius: string; color: string; colorChecked: string; colorDisabled: string; colorDisabledChecked: string; ... 18 more ...; labelFontWeight: string; }'.
border,
borderFocus,
borderDisabled,
borderChecked,
boxShadowFocus,
textColor,
textColorDisabled,
checkMarkColorDisabledChecked,
renderCheckMarkColorDisabledChecked,

Check failure on line 258 in src/checkbox/src/Checkbox.tsx

View workflow job for this annotation

GitHub Actions / lint (20)

Property 'renderCheckMarkColorDisabledChecked' does not exist on type '{ labelLineHeight: string; fontSizeSmall: string; fontSizeMedium: string; fontSizeLarge: string; borderRadius: string; color: string; colorChecked: string; colorDisabled: string; colorDisabledChecked: string; ... 18 more ...; labelFontWeight: string; }'.
colorDisabledChecked,
borderDisabledChecked,
labelPadding,
Expand Down Expand Up @@ -286,9 +286,10 @@ export default defineComponent({
'--n-color-disabled-checked': colorDisabledChecked,
'--n-text-color': textColor,
'--n-text-color-disabled': textColorDisabled,
'--n-check-mark-color': checkMarkColor,
'--n-check-mark-color-disabled': checkMarkColorDisabled,
'--n-check-mark-color-disabled-checked': checkMarkColorDisabledChecked,
'--n-check-mark-color': renderCheckMarkColor,
'--n-check-mark-color-disabled': renderCheckMarkColorDisabled,
'--n-check-mark-color-disabled-checked':
renderCheckMarkColorDisabledChecked,
'--n-font-size': fontSize,
'--n-label-padding': labelPadding
}
Expand Down Expand Up @@ -389,11 +390,11 @@ export default defineComponent({
key="indeterminate"
class={`${mergedClsPrefix}-checkbox-icon`}
>
{LineMark}
{renderLineMark()}
</div>
) : (
<div key="check" class={`${mergedClsPrefix}-checkbox-icon`}>
{CheckMark}
{renderCheckMark()}
</div>
)
}}
Expand Down
3 changes: 2 additions & 1 deletion src/checkbox/src/LineMark.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import type { VNode } from 'vue'
import { h } from 'vue'

export default (
export default (): VNode => (
<svg viewBox="0 0 100 100" class="line-icon">
<path d="M80.2,55.5H21.4c-2.8,0-5.1-2.5-5.1-5.5l0,0c0-3,2.3-5.5,5.1-5.5h58.7c2.8,0,5.1,2.5,5.1,5.5l0,0C85.2,53.1,82.9,55.5,80.2,55.5z" />
</svg>
Expand Down

0 comments on commit c84b2f2

Please sign in to comment.