Skip to content

Commit

Permalink
refactor: root layout use layout
Browse files Browse the repository at this point in the history
  • Loading branch information
kirill-ivanovvv committed Jul 1, 2024
1 parent b2c02f1 commit 9abb4f4
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions app/fragments/app-root-layout/src/root-layout.client.tsx
Original file line number Diff line number Diff line change
@@ -1,20 +1,24 @@
'use client'

import React from 'react'
import { IntlProvider } from 'react-intl'
import React from 'react'
import { IntlProvider } from 'react-intl'
import { useLayoutEffect } from 'react'

import { ErrorMessage } from '@ui/error-message'
import { ThemeProvider } from '@ui/theme'
import { ErrorMessage } from '@ui/error-message'
import { ThemeProvider } from '@ui/theme'

import { checkErrorHook } from './check-error.hook.js'
import { checkErrorHook } from './check-error.hook.js'

export const RootLayoutClient = ({ children, messages }) => {
let errorMessage
let errorCode

if (typeof window !== 'undefined') {
;({ errorMessage, errorCode } = checkErrorHook())
}
useLayoutEffect(() => {
if (typeof window !== 'undefined') {
// eslint-disable-next-line react-hooks/exhaustive-deps
;({ errorMessage, errorCode } = checkErrorHook())
}
}, [])

return (
<html>
Expand Down

0 comments on commit 9abb4f4

Please sign in to comment.