Skip to content

Commit

Permalink
prevents reader controls rerendering when chapter changes
Browse files Browse the repository at this point in the history
  • Loading branch information
land-cap committed Jan 2, 2024
1 parent 462a1f7 commit 59451dd
Show file tree
Hide file tree
Showing 19 changed files with 6 additions and 7 deletions.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,9 @@ import { type ReactNode } from 'react'
import { css, cx } from 'styled-system/css'
import { subgrid } from 'styled-system/patterns'

import { Separator } from '~/components'
import { labelCss } from '~/styles/label.css'

import { Separator } from '../../../../../../../components'

export const BookListSectionHeader = ({
children,
}: {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import { type ReactNode } from 'react'
import { css, cx } from 'styled-system/css'

import { Separator } from '~/components'
import { labelCss } from '~/styles/label.css'

import { Separator } from '../../../../../../../components'

export const ChapterListHeader = ({
children,
chapterListItemHeight,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { css } from 'styled-system/css'
import { styled } from 'styled-system/jsx'
import { center, hstack, macrogrid } from 'styled-system/patterns'

import { Icon, Separator } from '../../../../../../../components'
import { Icon, Separator } from '~/components'

const ButtonClose = styled('button', {
base: center.raw({
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { useAtomValue } from 'jotai'
import { useCallback } from 'react'

import { readerPageContainerElAtom } from '../../_readerPage.state'
import { readerPageContainerElAtom } from '~/app/[readerMode]/_readerPage.state'

import { useOnReaderParamChange } from './useOnReaderParamChange'

export const useResetReaderScrollOnParamChange = (
Expand All @@ -11,7 +12,7 @@ export const useResetReaderScrollOnParamChange = (
const readerPageContentEl = useAtomValue(readerPageContainerElAtom)

const handler = useCallback(() => {
readerPageContentEl && readerPageContentEl.scrollTo(0, 0)
readerPageContentEl?.scrollTo(0, 0)
}, [readerPageContentEl])

useOnReaderParamChange(handler, currBookCode, currChapter)
Expand Down
File renamed without changes.
File renamed without changes.

1 comment on commit 59451dd

@vercel
Copy link

@vercel vercel bot commented on 59451dd Jan 2, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

the-good-book – ./

the-good-book-dalandcap.vercel.app
the-good-book.vercel.app
the-good-book-git-master-dalandcap.vercel.app

Please sign in to comment.