Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Fix/source mangas white screen when directly open page via url #362

Merged
merged 2 commits into from
Jun 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/screens/SearchAll.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,9 @@ const SourceSearchPreview = React.memo(

useEffect(
() => () => {
// INFO:
// with strict mode + dev mode the first request will be aborted. due to using SWR there won't be an
// immediate second request since it's the same key. instead the "second" request will be the error handling of SWR
abortRequest(
new Error(`SourceSearchPreview(${source.id}, ${source.displayName}): search string changed`),
);
Expand Down
10 changes: 7 additions & 3 deletions src/screens/SourceMangas.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -163,9 +163,10 @@ export default function SourceMangas() {
const { sourceId } = useParams<{ sourceId: string }>();

const navigate = useNavigate();
const { state: { contentType: currentLocationContentType = SourceContentType.POPULAR } = {} } = useLocation<{
contentType: SourceContentType;
}>();
const { contentType: currentLocationContentType = SourceContentType.POPULAR } =
useLocation<{
contentType: SourceContentType;
}>().state ?? {};

const { options } = useLibraryOptionsContext();
const [query] = useQueryParam('query', StringParam);
Expand Down Expand Up @@ -247,6 +248,9 @@ export default function SourceMangas() {
return;
}

// INFO:
// with strict mode + dev mode the first request will be aborted. due to using SWR there won't be an
// immediate second request since it's the same key. instead the "second" request will be the error handling of SWR
abortRequest(new Error(`SourceMangas(${sourceId}): search string changed`));
},
[searchTerm, contentType],
Expand Down