File tree Expand file tree Collapse file tree 2 files changed +14
-17
lines changed Expand file tree Collapse file tree 2 files changed +14
-17
lines changed Original file line number Diff line number Diff line change 1+ ---
2+ " @scaleway/use-i18n " : patch
3+ ---
4+
5+ Remove usage of unstable_batch_update from react-dom as it's default behavior of react now
Original file line number Diff line number Diff line change @@ -16,7 +16,6 @@ import {
1616 useMemo ,
1717 useState ,
1818} from 'react'
19- import ReactDOM from 'react-dom'
2019import dateFormat , { type FormatDateOptions } from './formatDate'
2120import unitFormat , { type FormatUnitOptions } from './formatUnit'
2221import formatters , { type IntlListFormatOptions } from './formatters'
@@ -292,22 +291,15 @@ const I18nContextProvider = ({
292291 ...result [ currentLocale ] ?. default ,
293292 }
294293
295- // avoid a lot of render when async update
296- // This is handled automatically in react 18, but we leave it here for compat
297- // https://github.com/reactwg/react-18/discussions/21#discussioncomment-801703
298- ReactDOM . unstable_batchedUpdates ( ( ) => {
299- setTranslations ( prevState => ( {
300- ...prevState ,
301- ...{
302- [ currentLocale ] : {
303- ...prevState [ currentLocale ] ,
304- ...trad ,
305- } ,
306- } ,
307- } ) )
308-
309- setNamespaces ( prevState => [ ...new Set ( [ ...prevState , namespace ] ) ] )
310- } )
294+ setTranslations ( prevState => ( {
295+ ...prevState ,
296+ [ currentLocale ] : {
297+ ...prevState [ currentLocale ] ,
298+ ...trad ,
299+ } ,
300+ } ) )
301+
302+ setNamespaces ( prevState => [ ...new Set ( [ ...prevState , namespace ] ) ] )
311303
312304 return namespace
313305 } ,
You can’t perform that action at this time.
0 commit comments