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';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please remove the commented code


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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

here as well

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>
Comment on lines +304 to +306
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It won't be a good idea to show this option considering that the performance will be poor.

</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"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that placeholder is misleading and not required as input already has a label

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);
}
}}
Comment on lines +320 to +324
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please remove the onChange as it is not required after adding max and also will break the input from changing value.

step={1}
outlined
type="number"
Expand Down
Loading