diff --git a/README.md b/README.md index 9c340e8..d969bed 100644 --- a/README.md +++ b/README.md @@ -166,9 +166,8 @@ Page.getInitialProps = createGIP({ // It's run after all events are settled but before Scope serialization // So, here you can safely call allSettled async customize({ scope, context }) { - return { - /* Props */ - }; + // You can also return nothing (there will be no impact on props in this case) + return { /* Props */ }; }, }); ``` @@ -210,9 +209,8 @@ export const getServerSideProps = createGSSP({ // It's run after all events are settled but before Scope serialization // So, here you can safely call allSettled customize({ scope, context }) { - return { - /* GSSP Result */ - }; + // You can omit the "props" field (there will be no impact on props in this case) + return { /* GSSP Result */ }; }, }); ``` @@ -252,9 +250,8 @@ export const getStaticProps = createGSP({ // It's run after all events are settled but before Scope serialization // So, here you can safely call allSettled customize({ scope, context }) { - return { - /* GSP Result */ - }; + // You can omit the "props" field (there will be no impact on props in this case) + return { /* GSP Result */ }; }, }); ``` diff --git a/apps/test-app/.eslintrc.js b/apps/test-app/.eslintrc.js new file mode 100644 index 0000000..f0ea74e --- /dev/null +++ b/apps/test-app/.eslintrc.js @@ -0,0 +1,15 @@ +const { configure, presets } = require('eslint-kit') + +module.exports = configure({ + allowDebug: process.env.NODE_ENV !== 'production', + + presets: [ + presets.imports(), + presets.node(), + presets.prettier(), + presets.react(), + presets.nextJs(), + presets.effector(), + presets.typescript(), + ], +}) diff --git a/apps/test-app/.eslintrc.json b/apps/test-app/.eslintrc.json deleted file mode 100644 index bffb357..0000000 --- a/apps/test-app/.eslintrc.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": "next/core-web-vitals" -} diff --git a/apps/test-app/.prettierrc b/apps/test-app/.prettierrc new file mode 100644 index 0000000..2e4bf83 --- /dev/null +++ b/apps/test-app/.prettierrc @@ -0,0 +1,6 @@ +{ + "semi": false, + "singleQuote": true, + "tabWidth": 2, + "quoteProps": "consistent" +} \ No newline at end of file diff --git a/apps/test-app/package.json b/apps/test-app/package.json index 8eb3ef4..c7f11bf 100644 --- a/apps/test-app/package.json +++ b/apps/test-app/package.json @@ -21,7 +21,7 @@ "clsx": "^1.2.1", "effector": "^22.8.1", "effector-react": "^22.5.1", - "eslint": "8.38.0", + "eslint": "^8.39.0", "eslint-config-next": "13.3.0", "fs-extra": "^11.1.1", "next": "13.3.0", @@ -38,5 +38,8 @@ "@effector/next": "^0.3.0", "effector": "^22.8.1", "effector-react": "^22.5.1" + }, + "devDependencies": { + "eslint-kit": "^7.0.0" } } diff --git a/apps/test-app/pages/blog/[slug].tsx b/apps/test-app/pages/blog/[slug].tsx index 11ddbfc..55d3e02 100644 --- a/apps/test-app/pages/blog/[slug].tsx +++ b/apps/test-app/pages/blog/[slug].tsx @@ -8,7 +8,9 @@ import { localApi } from '@app/shared/api' const Page: NextPage = () => { console.info('[Render] BlogPostPage') + // eslint-disable-next-line effector/mandatory-scope-binding usePageEvent(appStarted, { runOnce: true }) + return } @@ -28,6 +30,7 @@ export const getStaticProps = createGSP< { slug: string } >({ pageEvent: pageStarted, + customize: () => ({ revalidate: 60 }), }) export default Page diff --git a/apps/test-app/pages/blog/index.tsx b/apps/test-app/pages/blog/index.tsx index 7eaa5cf..1677055 100644 --- a/apps/test-app/pages/blog/index.tsx +++ b/apps/test-app/pages/blog/index.tsx @@ -7,7 +7,9 @@ import { appStarted } from '@app/pages/shared/model' const Page: NextPage = () => { console.info('[Render] BlogPage') + // eslint-disable-next-line effector/mandatory-scope-binding usePageEvent(appStarted, { runOnce: true }) + return } diff --git a/apps/test-app/src/pages/blog-post/page.tsx b/apps/test-app/src/pages/blog-post/page.tsx index 8e4fd16..d2db242 100644 --- a/apps/test-app/src/pages/blog-post/page.tsx +++ b/apps/test-app/src/pages/blog-post/page.tsx @@ -1,10 +1,10 @@ -import { useStore } from 'effector-react' +import { useUnit } from 'effector-react' import { BaseTemplate } from '@app/computed/widgets/layouts' import { $categories, $post } from './model' export function BlogPostPage() { - const post = useStore($post) - const categories = useStore($categories) + const post = useUnit($post) + const categories = useUnit($categories) if (!post) { return null diff --git a/apps/test-app/src/pages/blog/page.tsx b/apps/test-app/src/pages/blog/page.tsx index 0576143..bc6cce6 100644 --- a/apps/test-app/src/pages/blog/page.tsx +++ b/apps/test-app/src/pages/blog/page.tsx @@ -1,18 +1,23 @@ -import { useStore } from 'effector-react' +import { useUnit } from 'effector-react' import Link from 'next/link' import { BaseTemplate } from '@app/computed/widgets/layouts' import { paths } from '@app/shared/routing' import { $posts } from './model' export function BlogPage() { - const posts = useStore($posts) + const posts = useUnit($posts) return ( { return ( - +

{post.title}

diff --git a/apps/test-app/src/pages/home/page.tsx b/apps/test-app/src/pages/home/page.tsx index 97a8086..78d5931 100644 --- a/apps/test-app/src/pages/home/page.tsx +++ b/apps/test-app/src/pages/home/page.tsx @@ -1,9 +1,9 @@ -import { useStore } from 'effector-react' +import { useUnit } from 'effector-react' import { BaseTemplate } from '@app/computed/widgets/layouts' import { $authenticatedUser } from '@app/entities/authenticated-user' export function HomePage() { - const user = useStore($authenticatedUser) + const user = useUnit($authenticatedUser) return ( @@ -37,7 +37,7 @@ export function Header() {