‼️fix: floor-plan 하위 렌더링시 조건부 추가
- floot-plan , estimate, simulator 렌더링 조건 분리 - ManagementProvider 에 리코일 로직 추가
This commit is contained in:
parent
cb3780844c
commit
d68610440e
@ -2,8 +2,6 @@
|
||||
|
||||
import { correntObjectNoState } from '@/store/settingAtom'
|
||||
import { notFound, usePathname, useSearchParams } from 'next/navigation'
|
||||
// import { ErrorBoundary } from 'next/dist/client/components/error-boundary'
|
||||
// import ServerError from '../error'
|
||||
import { createContext, useReducer, useState } from 'react'
|
||||
import { useSetRecoilState } from 'recoil'
|
||||
|
||||
|
||||
@ -3,15 +3,23 @@
|
||||
import FloorPlanProvider from './FloorPlanProvider'
|
||||
import FloorPlan from '@/components/floor-plan/FloorPlan'
|
||||
import CanvasLayout from '@/components/floor-plan/CanvasLayout'
|
||||
import { usePathname } from 'next/navigation'
|
||||
|
||||
export default function FloorPlanLayout({ children }) {
|
||||
console.log('🚀 ~ FloorPlanLayout ~ FloorPlanLayout:')
|
||||
const pathname = usePathname()
|
||||
console.log('🚀 ~ FloorPlanLayout ~ pathname:', pathname)
|
||||
|
||||
return (
|
||||
<>
|
||||
<FloorPlanProvider>
|
||||
<FloorPlan>
|
||||
<CanvasLayout>{children}</CanvasLayout>
|
||||
{pathname.includes('estimate') || pathname.includes('simulator') ? (
|
||||
<div className="canvas-layout">{children}</div>
|
||||
) : (
|
||||
<CanvasLayout>{children}</CanvasLayout>
|
||||
)}
|
||||
{/* <CanvasLayout>{children}</CanvasLayout> */}
|
||||
</FloorPlan>
|
||||
</FloorPlanProvider>
|
||||
</>
|
||||
|
||||
@ -1,6 +1,9 @@
|
||||
'ues client'
|
||||
|
||||
import { createContext, useEffect, useState } from 'react'
|
||||
import { useSearchParams } from 'next/navigation'
|
||||
import { useSetRecoilState } from 'recoil'
|
||||
import { correntObjectNoState } from '@/store/settingAtom'
|
||||
|
||||
export const ManagementContext = createContext({
|
||||
managementState: {},
|
||||
@ -10,6 +13,11 @@ export const ManagementContext = createContext({
|
||||
const ManagementProvider = ({ children }) => {
|
||||
const [managementState, setManagementState] = useState({})
|
||||
|
||||
const setCurrentObjectNo = useSetRecoilState(correntObjectNoState)
|
||||
const searchParams = useSearchParams()
|
||||
const objectNo = searchParams.get('objectNo')
|
||||
setCurrentObjectNo(objectNo)
|
||||
|
||||
useEffect(() => {
|
||||
console.log('🚀 ~ managementState:', managementState)
|
||||
}, [managementState])
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user