feat: add in-squad post search#6301
Open
rebelchris wants to merge 3 commits into
Open
Conversation
Lets members and public visitors filter a squad's feed by text query via a search field in the squad heading, mirroring the bookmarks in-feed search pattern. Submitting writes `?q=` to the URL (shallow) and swaps the feed to the new searchSourcePosts query; clearing restores the default sourceFeed. - Add SEARCH_SOURCE_POSTS_QUERY (mirrors SEARCH_BOOKMARKS_QUERY) and the search-squad feed page key - Add opt-in `enableSuggestions` prop to PostsSearch so this source-scoped surface doesn't show wrong-scope Mimir suggestions - Add opt-in `searchChildren` slot to SquadFeedHeading for the search field - Wire the squad page to swap query/variables/feedQueryKey/emptyScreen based on `router.query.q`, and build the submit/clear handlers from `asPath` instead of `router.pathname` (the latter is the dynamic route pattern `/squads/[handle]` and breaks Next's router.replace when the `handle` param isn't in the query object)
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
Author
|
Related PRs (deploy in this order):
|
- SquadFeedHeading: match the bookmarks CustomFeedHeader idiom — the search field now fills the heading row with the pinned-posts toggle directly after it (no dead gap), wrapping below on narrow widths. Field medium size matches the button's h-10/rounded-12 scale exactly. - Fix all strict-mode errors in the touched shared files so typecheck-strict-changed passes: typed suggestionType as a key of SEARCH_TYPES, null-initialized searchBoxRef, guarded the optional querySelector/focus chain and query fallback in PostsSearch; fail-fast guard for the optional pinned-posts mutations and squad id in SquadFeedHeading.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds a search field to the squad page that filters the squad's feed by text query, backed by the new
searchSourcePostsGraphQL query (companion daily-api PR).How
SEARCH_SOURCE_POSTS_QUERYinpackages/shared/src/graphql/feed.ts, mirroringSEARCH_BOOKMARKS_QUERY.squads/[handle]/index.tsx): when?q=is present, the feed renders with the search query (feedName: OtherFeedPage.SearchSquad,SearchEmptyScreenon no results); otherwise the existingSOURCE_FEED_QUERY. DistinctfeedQueryKeys so caches never collide — same pattern asBookmarkFeedLayout.versioncomes from the existingfeature.searchVersionflag, consistent with global search.PostsSearchrendered in a new opt-insearchChildrenslot onSquadFeedHeading, with a newenableSuggestionsprop (defaulttrueeverywhere else) set tofalsehere — post suggestions are Mimir-backed and not source-scoped, so they'd show wrong-scope results. Available to members and public-squad visitors alike; the backend enforces permissions.RouterPostsSearch'srouter.replace({pathname: router.pathname})breaks on dynamic routes (router.pathnameis the pattern/squads/[handle], not the concrete path — verified against Next'sresolveHref). The squad page builds the concrete path fromrouter.asPath+getPathnameWithQueryand does a shallow replace instead.SubmitSearch/FocusSearchwithSearchProviderEnum.Posts) — no new taxonomy.Verification
@dailydotdev/sharedandwebapp.mainvia stash comparison).feed.spec.ts+Feed.spec.tsx: 50/50 passing.Deploy order
Merge/deploy last, after the mimir index PR and the daily-api PR. Related PRs linked in a comment below.
🤖 Generated with Claude Code
Preview domain
https://feat-squad-post-search.preview.app.daily.dev