Feature/virtualize manga grid (#363)

* Disable ssr by default for "useMediaQuery"

SSR would cause the hook to run once with default values and only after the first render with real values.
This can cause issue on rendering when depending on useMediaQuery results like in 8c129f2e08

* Virtualize manga grids

* Remove SourceMangas load more guard

Was required due to the previous load more trigger logic from the MangaGrid.
Due to using Virtuoso now, load more will be triggered only once when the bottom of the grid was reached and thus won't trigger multiple load more requests

* Remove old Library pagination

Pagination is handled by virtuoso, thus, the previous pagination can be removed

* Increase initial loaded pages to make infinite load work

virtuoso requires enough initial items to be rendered, so that actual virtualization takes effect, for it to fire "endReached"

* Prevent virtuoso grid scrollbar from jumping around

In case the items have a big height difference there is a bug where the scrollbar starts jumping around the moment these new items are rendered

* Restore scroll position

For some reason the UI jumps around when accessing "document.documentElement" during loading more items.
After the items are rendered the loading placeholder gets removed and the previous items jump to the bottom of the viewport.

* Limit manga grid titles to two lines

* Remove "last page" info from MangaGrid

Info is not needed. The only thing the MangaGrid has to do is to trigger a request to load more data
This commit is contained in:
schroda
2023-06-17 16:50:17 +02:00
committed by GitHub
parent 3ad33b0a15
commit 19d27fdf26
7 changed files with 382 additions and 285 deletions

View File

@@ -37,6 +37,11 @@ const createTheme = (dark?: boolean) => {
},
},
components: {
MuiUseMediaQuery: {
defaultProps: {
noSsr: true,
},
},
MuiCssBaseline: {
styleOverrides: `
*::-webkit-scrollbar {