Skip to content

Block List Search Functionality #211#435

Open
rumanstheddy wants to merge 7 commits into
ClearskyApp06:devfrom
rumanstheddy:feature/list-search-211
Open

Block List Search Functionality #211#435
rumanstheddy wants to merge 7 commits into
ClearskyApp06:devfrom
rumanstheddy:feature/list-search-211

Conversation

@rumanstheddy
Copy link
Copy Markdown
Contributor

No description provided.

…and UI updates

- Implemented `runWithConcurrencyAndRetry` for async tasks with retry logic on 429 errors.
- Added `fetchIsBlocking` and `fetchIsBlockedBy` functions for checking block status.
- Enhanced `BlockPanelGeneric` to support searching for blocked accounts.
- Updated CSS for search panel visibility.
- Updated search functionality in `SearchAutoComplete` with filtering options.
- Modified 'Blocked By' Panel and 'Blocking' Panel to pass `userHandle` and `isBlockingPanel` props.
@vercel
Copy link
Copy Markdown

vercel Bot commented Jan 14, 2026

@rumanstheddy is attempting to deploy a commit to the Clearsky Team on Vercel.

A member of the Team first needs to authorize it.

@vercel
Copy link
Copy Markdown

vercel Bot commented Jan 15, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
clearsky-ui Ready Ready Preview, Comment Feb 6, 2026 2:56pm

@vercel
Copy link
Copy Markdown

vercel Bot commented Jan 15, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Review Updated (UTC)
clearsky-ui Building Building Preview, Comment Jan 15, 2026 5:54pm

@thieflord06
Copy link
Copy Markdown
Member

@rumanstheddy working this now.

@thieflord06
Copy link
Copy Markdown
Member

@rumanstheddy List search bar isn't working correctly.

@rumanstheddy
Copy link
Copy Markdown
Contributor Author

rumanstheddy commented Feb 4, 2026

@thieflord06 Are the results not showing up?
Can you give me an example to test it with?

@thieflord06
Copy link
Copy Markdown
Member

When I click on the search icon the bar to type doesn't show up.

@rumanstheddy
Copy link
Copy Markdown
Contributor Author

rumanstheddy commented Feb 4, 2026

Could you please send a photo/video of what you see when you click the button?
This was recorded on Firefox. I verified the functionality on Chrome and Brave as well.

Screen.Recording.2026-02-04.174751.mp4

@thieflord06
Copy link
Copy Markdown
Member

@rumanstheddy I'm on chrome. It seems that the deploy is messed up somehow.

This is your latest deploy:
https://clearsky-b2668ml6g-clearsky-projects.vercel.app/

@rumanstheddy
Copy link
Copy Markdown
Contributor Author

@thieflord06 yeah, even the home page looks messed up.

image

@thieflord06
Copy link
Copy Markdown
Member

@rumanstheddy can you push it again with a comment or something to see if that fixes it?

I tried redeploying and it didn't fix it.

@rumanstheddy
Copy link
Copy Markdown
Contributor Author

rumanstheddy commented Feb 5, 2026

@thieflord06 Sure. Just pushed a change.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adds search functionality to the block lists (Blocking and Blocked By panels) in the Clearsky application. Users can now search for specific accounts within their block lists to quickly verify block relationships.

Changes:

  • Added customizable label prop and async filtering support to the SearchAutoComplete component
  • Implemented new API endpoints (fetchIsBlocking, fetchIsBlockedBy, and batch variants) with caching and retry logic for 429 errors
  • Integrated search UI into block panels with feature flag gating (blocking-searching)

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 14 comments.

Show a summary per file
File Description
src/landing/search-autocomplete/search-autocomplete.jsx Added filterOptionsAsync and label props to enable custom filtering and labels for the search component
src/detail-panels/blocking/index.jsx Passed userHandle and isBlockingPanel props to enable search filtering in the blocking panel
src/detail-panels/blocked-by/index.jsx Passed userHandle and isBlockingPanel props to enable search filtering in the blocked-by panel
src/detail-panels/block-panel-generic/block-panel-generic.jsx Added search UI with toggle button, integrated SearchAutoComplete component, and implemented filtering logic
src/detail-panels/block-panel-generic/block-panel-generic.css Added styles for search button, search container, and adjusted layout to accommodate search UI
src/api/blocklist.js Implemented new API functions for checking block relationships with caching, concurrency control, and retry logic

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/api/blocklist.js
// Attach cache keys to entries
const entriesWithCacheKey = entries.map((entry) => ({
...entry,
_cacheKey: `${handle}:blockedby:${entry.shortHandle}`,
Copy link

Copilot AI Feb 6, 2026

Choose a reason for hiding this comment

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

The cache key uses a simple string concatenation pattern (e.g., 'handle:blocking:otherHandle'). If handles contain colons, this could lead to cache key collisions. While unlikely for valid Bluesky handles, consider using a more robust key generation approach such as JSON.stringify or a dedicated cache key builder function to prevent potential collisions.

Suggested change
_cacheKey: `${handle}:blockedby:${entry.shortHandle}`,
_cacheKey: JSON.stringify(['blockedby', handle, entry.shortHandle]),

Copilot uses AI. Check for mistakes.
'/' +
unwrapShortHandle(account.shortHandle) +
'/history/?q=' +
account.postID
Copy link

Copilot AI Feb 6, 2026

Choose a reason for hiding this comment

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

The navigation URL construction for postID uses query parameter concatenation without proper encoding. If account.postID contains special characters, the URL could be malformed. Consider using URLSearchParams or encodeURIComponent to properly encode the postID value.

Suggested change
account.postID
encodeURIComponent(account.postID)

Copilot uses AI. Check for mistakes.
Comment thread src/api/blocklist.js
Comment on lines +224 to +230
export async function fetchIsBlocking(handle1, handle2) {
const url = `blocklist-search-blocking/${unwrapShortHandle(
handle1
)}/${unwrapShortHandle(handle2)}`;
const res = await fetchClearskyApi('v1', url);
return res?.data ?? null;
}
Copy link

Copilot AI Feb 6, 2026

Choose a reason for hiding this comment

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

The fetchIsBlocking and fetchIsBlockedBy functions return null when the API response data is undefined, but the calling code in fetchIsBlockingMany/fetchIsBlockedByMany checks for valid data structure (lines 269-273, 299-304). If the API returns a successful response with an unexpected structure, it will be treated as undefined and filtered out. This is safe, but consider adding validation or logging to help identify API contract changes.

Copilot uses AI. Check for mistakes.
Comment on lines +196 to +197
// userHandle,
// isBlockingPanel,
Copy link

Copilot AI Feb 6, 2026

Choose a reason for hiding this comment

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

These commented-out destructured props (userHandle, isBlockingPanel) are not used anywhere in the PanelHeader component. They were likely part of an earlier implementation where these values were passed directly to PanelHeader, but the final implementation passes filterOptionsAsync instead. These should be removed to avoid confusion.

Suggested change
// userHandle,
// isBlockingPanel,

Copilot uses AI. Check for mistakes.
* onAccountSelected?: (account: Partial<AccountInfo & SearchMatch>) => void,
* onResolveAccount?: (text: string) => Promise<AccountInfo[]>
* onResolveAccount?: (text: string) => Promise<AccountInfo[]>,
* filterOptionsAsync?: (entry: any) => Promise<boolean>,
Copy link

Copilot AI Feb 6, 2026

Choose a reason for hiding this comment

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

The type annotation for filterOptionsAsync indicates it should return Promise, but the implementation in block-panel-generic.jsx returns Promise, and the code at lines 197-199 expects an array. This is a type mismatch that could lead to confusion. The type annotation should be changed to reflect that this function receives an array and returns a filtered array: (entries: any[]) => Promise<any[]>.

Suggested change
* filterOptionsAsync?: (entry: any) => Promise<boolean>,
* filterOptionsAsync?: (entries: any[]) => Promise<any[]>,

Copilot uses AI. Check for mistakes.
import { TableChart, TableRows } from '@mui/icons-material';
import SearchIcon from '@mui/icons-material/Search';
import { Button, CircularProgress } from '@mui/material';
import { Box, Button, CircularProgress, IconButton } from '@mui/material';
Copy link

Copilot AI Feb 6, 2026

Choose a reason for hiding this comment

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

The Box import from '@mui/material' is added but never used in the component code. This unused import should be removed to keep the code clean.

Suggested change
import { Box, Button, CircularProgress, IconButton } from '@mui/material';
import { Button, CircularProgress, IconButton } from '@mui/material';

Copilot uses AI. Check for mistakes.
* onResolveAccount?: (text: string) => Promise<AccountInfo[]>
* onResolveAccount?: (text: string) => Promise<AccountInfo[]>,
* filterOptionsAsync?: (entry: any) => Promise<boolean>,
* label?: {en : string, localised: { [lang: string]: string }},
Copy link

Copilot AI Feb 6, 2026

Choose a reason for hiding this comment

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

There's inconsistent spacing in the JSDoc type definition. The line has 'en : string' with a space before the colon, while the standard TypeScript/JavaScript convention is to have no space before the colon. This should be 'en: string' for consistency with coding standards.

Suggested change
* label?: {en : string, localised: { [lang: string]: string }},
* label?: {en: string, localised: { [lang: string]: string }},

Copilot uses AI. Check for mistakes.
Comment on lines +57 to +58
// const { accountFullHandle } = useAuth();

Copy link

Copilot AI Feb 6, 2026

Choose a reason for hiding this comment

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

This commented-out code appears to be from an earlier implementation that was abandoned in favor of passing userHandle as a prop. Since it's not being used and there's no clear reason to keep it for future reference, it should be removed to keep the codebase clean.

Suggested change
// const { accountFullHandle } = useAuth();

Copilot uses AI. Check for mistakes.
text-align: right;
}

.MuiBox-root .css-r82bso {
Copy link

Copilot AI Feb 6, 2026

Choose a reason for hiding this comment

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

The CSS selector '.MuiBox-root .css-r82bso' targets a Material-UI auto-generated class name, which is not stable across versions or builds. These hashed class names can change with Material-UI version updates or configuration changes, causing the style to stop working. Consider using a custom class name on the component or a more stable selector approach instead.

Suggested change
.MuiBox-root .css-r82bso {
.MuiBox-root > :first-child {

Copilot uses AI. Check for mistakes.
Comment thread src/api/blocklist.js
Comment on lines +1 to +2
// Simple in-memory cache for endpoint results
const _blocklistCache = new Map();
Copy link

Copilot AI Feb 6, 2026

Choose a reason for hiding this comment

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

The in-memory cache uses a Map without any size limits or TTL (time-to-live). This can lead to unbounded memory growth over time as users search for many different accounts. Consider implementing cache eviction strategies such as LRU (Least Recently Used) or setting a maximum cache size, or adding a TTL to expire old entries.

Copilot uses AI. Check for mistakes.
@rumanstheddy
Copy link
Copy Markdown
Contributor Author

@thieflord06 did it help?

@thieflord06
Copy link
Copy Markdown
Member

@rumanstheddy No change.

@rumanstheddy
Copy link
Copy Markdown
Contributor Author

rumanstheddy commented Feb 14, 2026

@thieflord06 is it fixed?
Want me to try another commit?

@thieflord06
Copy link
Copy Markdown
Member

@rumanstheddy When I run locally the home page looks normal.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants