From 9c02ef3616b4ed6364f5e31085bb02bb7f0ff293 Mon Sep 17 00:00:00 2001 From: Joaquin Alfaro Date: Mon, 8 Aug 2022 12:24:28 +0200 Subject: [PATCH 1/2] Render child of MainLayout when state is changed --- components/ui/MainLayout.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/components/ui/MainLayout.tsx b/components/ui/MainLayout.tsx index 0d3abd5..c81f0a9 100644 --- a/components/ui/MainLayout.tsx +++ b/components/ui/MainLayout.tsx @@ -26,7 +26,8 @@ export const MainLayout: FC> = memo( prev.metaTitle === next.metaTitle && prev.metaDescription === next.metaDescription && prev.metaImage === next.metaImage && - prev.metaUrl === next.metaUrl + prev.metaUrl === next.metaUrl && + prev.children === next.children ); MainLayout.displayName = 'MainLayout'; From d01b4bcda8f98b8034d15c0028565e1d2eb975ca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julian=20=C4=86wirko?= Date: Fri, 12 Aug 2022 22:27:58 +0200 Subject: [PATCH 2/2] fixes and updates --- .eslintrc | 3 + CHANGELOG.md | 4 + components/ui/MainLayout.tsx | 52 +- package-lock.json | 3210 +++++++++++++++++----------------- package.json | 35 +- 5 files changed, 1702 insertions(+), 1602 deletions(-) diff --git a/.eslintrc b/.eslintrc index ec78d59..adbe94d 100644 --- a/.eslintrc +++ b/.eslintrc @@ -5,6 +5,9 @@ "plugin:valtio/recommended", "plugin:@typescript-eslint/recommended" ], + "rules": { + "valtio/state-snapshot-rule": "off" + }, "plugins": ["@typescript-eslint"], "parser": "@typescript-eslint/parser" } diff --git a/CHANGELOG.md b/CHANGELOG.md index 1774143..a741924 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +### [2.0.1](https://github.com/ElrondDevGuild/nextjs-dapp-template/releases/tag/v2.0.1) +- fix problems with rerendering (wrong memo usage) +- update dependencies + ### [2.0.0](https://github.com/ElrondDevGuild/nextjs-dapp-template/releases/tag/v2.0.0) - Nextjs update - React update diff --git a/components/ui/MainLayout.tsx b/components/ui/MainLayout.tsx index c81f0a9..fc787be 100644 --- a/components/ui/MainLayout.tsx +++ b/components/ui/MainLayout.tsx @@ -1,33 +1,31 @@ import { Container, Box } from '@chakra-ui/react'; -import { FC, memo, PropsWithChildren } from 'react'; +import { FC, PropsWithChildren } from 'react'; import { MetaHead, MetaHeadProps } from './MetaHead'; import { Footer } from './Footer'; -export const MainLayout: FC> = memo( - ({ children, metaTitle, metaDescription, metaImage, metaUrl }) => { - return ( - <> - - - - {children} - - -