Skip to content

Commit

Permalink
fix: checkbox to useIsomorphicLayoutEffect (#2155)
Browse files Browse the repository at this point in the history
Co-authored-by: Erik Hughes <erik.hughes@outlook.com>
  • Loading branch information
mperrotti and Swiftwork authored Jun 28, 2022
1 parent 96ad635 commit 003cbcf
Show file tree
Hide file tree
Showing 4 changed files with 79 additions and 37 deletions.
5 changes: 5 additions & 0 deletions .changeset/chilled-cats-smash.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@primer/react': patch
---

Update Checkbox component to useIsomorphicLayoutEffect instead of useLayoutEffect to support SSR
105 changes: 70 additions & 35 deletions docs/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion src/Checkbox.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import styled from 'styled-components'
import {useProvidedRefOrCreate} from './hooks'
import React, {ChangeEventHandler, InputHTMLAttributes, ReactElement, useContext, useLayoutEffect} from 'react'
import React, {ChangeEventHandler, InputHTMLAttributes, ReactElement, useContext} from 'react'
import sx, {SxProp} from './sx'
import useLayoutEffect from './utils/useIsomorphicLayoutEffect'
import {FormValidationStatus} from './utils/types/FormValidationStatus'
import {CheckboxGroupContext} from './CheckboxGroup'
import getGlobalFocusStyles from './_getGlobalFocusStyles'
Expand Down
3 changes: 2 additions & 1 deletion src/stories/Checkbox.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import React, {useLayoutEffect, useRef, useState} from 'react'
import React, {useRef, useState} from 'react'
import {Meta} from '@storybook/react'
import styled from 'styled-components'

import {BaseStyles, Box, Checkbox, CheckboxProps, Text, ThemeProvider} from '..'
import useLayoutEffect from '../utils/useIsomorphicLayoutEffect'
import {action} from '@storybook/addon-actions'
import {get} from '../constants'

Expand Down

0 comments on commit 003cbcf

Please sign in to comment.