Skip to content

Commit

Permalink
possibly memory fix
Browse files Browse the repository at this point in the history
  • Loading branch information
mienaiyami committed May 17, 2023
1 parent 41ae87a commit 62adff0
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
4 changes: 4 additions & 0 deletions src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,7 @@ const App = (): ReactElement => {
*/
const openInReader = (link: string, page_or_chapterName?: number | string, elementQueryString?: string) => {
link = window.path.normalize(link);
window.electron.webFrame.clearCache();
if (link === linkInReader.link) return;
if (link.toLowerCase().includes(".epub")) {
dispatch(setUnzipping(true));
Expand Down Expand Up @@ -249,6 +250,9 @@ const App = (): ReactElement => {

document.body.classList.remove("zenMode");
if (document.fullscreenElement) document.exitFullscreen();
setTimeout(() => {
window.electron.webFrame.clearCache();
}, 1500);
};

const openInNewWindow = (link: string) => {
Expand Down
4 changes: 3 additions & 1 deletion src/Components/Reader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -500,6 +500,8 @@ const Reader = () => {
setImageWidthContainer([]);
setImageElementsIndex([]);
setImageRowCount(0);
setImageDecodeQueue([]);
setCurrentlyDecoding(false);
setBookmarked(bookmarks.map((e) => e.data.link).includes(link));
setChapterChangerDisplay(false);
const linksplitted = link.split(window.path.sep).filter((e) => e !== "");
Expand All @@ -526,7 +528,7 @@ const Reader = () => {
dispatch(setReaderOpen(true));
};
useLayoutEffect(() => {
window.electron.webFrame.clearCache();
// window.electron.webFrame.clearCache();
images.forEach((e, i) => {
const img = document.createElement("img");

Expand Down

0 comments on commit 62adff0

Please sign in to comment.