‼️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 { correntObjectNoState } from '@/store/settingAtom'
|
||||||
import { notFound, usePathname, useSearchParams } from 'next/navigation'
|
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 { createContext, useReducer, useState } from 'react'
|
||||||
import { useSetRecoilState } from 'recoil'
|
import { useSetRecoilState } from 'recoil'
|
||||||
|
|
||||||
|
|||||||
@ -3,15 +3,23 @@
|
|||||||
import FloorPlanProvider from './FloorPlanProvider'
|
import FloorPlanProvider from './FloorPlanProvider'
|
||||||
import FloorPlan from '@/components/floor-plan/FloorPlan'
|
import FloorPlan from '@/components/floor-plan/FloorPlan'
|
||||||
import CanvasLayout from '@/components/floor-plan/CanvasLayout'
|
import CanvasLayout from '@/components/floor-plan/CanvasLayout'
|
||||||
|
import { usePathname } from 'next/navigation'
|
||||||
|
|
||||||
export default function FloorPlanLayout({ children }) {
|
export default function FloorPlanLayout({ children }) {
|
||||||
console.log('🚀 ~ FloorPlanLayout ~ FloorPlanLayout:')
|
console.log('🚀 ~ FloorPlanLayout ~ FloorPlanLayout:')
|
||||||
|
const pathname = usePathname()
|
||||||
|
console.log('🚀 ~ FloorPlanLayout ~ pathname:', pathname)
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<FloorPlanProvider>
|
<FloorPlanProvider>
|
||||||
<FloorPlan>
|
<FloorPlan>
|
||||||
<CanvasLayout>{children}</CanvasLayout>
|
{pathname.includes('estimate') || pathname.includes('simulator') ? (
|
||||||
|
<div className="canvas-layout">{children}</div>
|
||||||
|
) : (
|
||||||
|
<CanvasLayout>{children}</CanvasLayout>
|
||||||
|
)}
|
||||||
|
{/* <CanvasLayout>{children}</CanvasLayout> */}
|
||||||
</FloorPlan>
|
</FloorPlan>
|
||||||
</FloorPlanProvider>
|
</FloorPlanProvider>
|
||||||
</>
|
</>
|
||||||
|
|||||||
@ -1,6 +1,9 @@
|
|||||||
'ues client'
|
'ues client'
|
||||||
|
|
||||||
import { createContext, useEffect, useState } from 'react'
|
import { createContext, useEffect, useState } from 'react'
|
||||||
|
import { useSearchParams } from 'next/navigation'
|
||||||
|
import { useSetRecoilState } from 'recoil'
|
||||||
|
import { correntObjectNoState } from '@/store/settingAtom'
|
||||||
|
|
||||||
export const ManagementContext = createContext({
|
export const ManagementContext = createContext({
|
||||||
managementState: {},
|
managementState: {},
|
||||||
@ -10,6 +13,11 @@ export const ManagementContext = createContext({
|
|||||||
const ManagementProvider = ({ children }) => {
|
const ManagementProvider = ({ children }) => {
|
||||||
const [managementState, setManagementState] = useState({})
|
const [managementState, setManagementState] = useState({})
|
||||||
|
|
||||||
|
const setCurrentObjectNo = useSetRecoilState(correntObjectNoState)
|
||||||
|
const searchParams = useSearchParams()
|
||||||
|
const objectNo = searchParams.get('objectNo')
|
||||||
|
setCurrentObjectNo(objectNo)
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
console.log('🚀 ~ managementState:', managementState)
|
console.log('🚀 ~ managementState:', managementState)
|
||||||
}, [managementState])
|
}, [managementState])
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user