Remove context usage from ReaderChapterViewer
In case many chapters are rendered, even just the HOC wrapper component re-render due to the context change increases the render time. Thus, getting rid of these HOC wrapper re-renders by moving the context usage up to the ReaderViewer decreases the render time.
This commit is contained in:
@@ -6,7 +6,7 @@
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
import { ForwardRefExoticComponent, MemoExoticComponent, RefAttributes } from 'react';
|
||||
import { ComponentType, MemoExoticComponent } from 'react';
|
||||
import {
|
||||
IReaderSettings,
|
||||
IReaderSettingsWithDefaultFlag,
|
||||
@@ -59,7 +59,7 @@ export const isAutoWebtoonMode = (
|
||||
|
||||
export const getPagerForReadingMode = (
|
||||
readingMode: ReadingMode,
|
||||
): MemoExoticComponent<ForwardRefExoticComponent<Omit<ReaderPagerProps, never> & RefAttributes<HTMLElement>>> => {
|
||||
): MemoExoticComponent<ComponentType<ReaderPagerProps>> => {
|
||||
switch (readingMode) {
|
||||
case ReadingMode.SINGLE_PAGE:
|
||||
return ReaderPagedPager;
|
||||
|
||||
Reference in New Issue
Block a user