Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Bug Fix - Tab Crashes when page limit exceeds a certain amout (e.g. 10000) on explore community tab. #2109

Open
wants to merge 3 commits into
base: dev
Choose a base branch
from
Open
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
12 changes: 12 additions & 0 deletions src/app/pages/client/explore/Server.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ import { getMxIdServer } from '../../../utils/matrix';
import { stopPropagation } from '../../../utils/keyboard';
import { ScreenSize, useScreenSizeContext } from '../../../hooks/useScreenSize';
import { BackRouteHandler } from '../../../components/BackRouteHandler';
// import { LimitWarning } from './LimitWarning';

const useServerSearchParams = (searchParams: URLSearchParams): ExploreServerPathSearchParams =>
useMemo(
Expand Down Expand Up @@ -260,6 +261,7 @@ function LimitButton({ limit, onLimitChange }: LimitButtonProps) {
if (!limitInput) return;
const newLimit = limitInput.value.trim();
if (!newLimit) return;
// my work here
onLimitChange(newLimit);
};

Expand Down Expand Up @@ -299,17 +301,27 @@ function LimitButton({ limit, onLimitChange }: LimitButtonProps) {
<Chip variant="SurfaceVariant" onClick={() => setLimit('96')} radii="Pill">
<Text size="T200">96</Text>
</Chip>
<Chip variant="SurfaceVariant" onClick={() => setLimit('10000')} radii="Pill">
<Text size="T200">Max</Text>
</Chip>
</Box>
</Box>
<Box as="form" onSubmit={handleLimitSubmit} direction="Column" gap="300">
<Box direction="Column" gap="100">
<Text size="L400">Custom Limit</Text>
<Input
placeholder="Max limit- 10000"
name="limitInput"
size="300"
variant="Background"
defaultValue={limit}
min={1}
max={10000}
onChange={(e: React.ChangeEvent<HTMLInputElement>) => {
if (parseInt(e.target.value) > 10000) {
e.target.value = e.target.value.slice(0, 4);
}
}}
step={1}
outlined
type="number"
Expand Down
Loading