Skip to content

feat: add in-squad post search#6301

Open
rebelchris wants to merge 3 commits into
mainfrom
feat/squad-post-search
Open

feat: add in-squad post search#6301
rebelchris wants to merge 3 commits into
mainfrom
feat/squad-post-search

Conversation

@rebelchris

@rebelchris rebelchris commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

What

Adds a search field to the squad page that filters the squad's feed by text query, backed by the new searchSourcePosts GraphQL query (companion daily-api PR).

How

  • SEARCH_SOURCE_POSTS_QUERY in packages/shared/src/graphql/feed.ts, mirroring SEARCH_BOOKMARKS_QUERY.
  • Query swap on the squad page (squads/[handle]/index.tsx): when ?q= is present, the feed renders with the search query (feedName: OtherFeedPage.SearchSquad, SearchEmptyScreen on no results); otherwise the existing SOURCE_FEED_QUERY. Distinct feedQueryKeys so caches never collide — same pattern as BookmarkFeedLayout. version comes from the existing feature.searchVersion flag, consistent with global search.
  • Search bar: PostsSearch rendered in a new opt-in searchChildren slot on SquadFeedHeading, with a new enableSuggestions prop (default true everywhere else) set to false here — 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.
  • Routing note: RouterPostsSearch's router.replace({pathname: router.pathname}) breaks on dynamic routes (router.pathname is the pattern /squads/[handle], not the concrete path — verified against Next's resolveHref). The squad page builds the concrete path from router.asPath + getPathnameWithQuery and does a shallow replace instead.
  • Analytics mirrors the existing search events (SubmitSearch/FocusSearch with SearchProviderEnum.Posts) — no new taxonomy.

Verification

  • Lint clean in @dailydotdev/shared and webapp.
  • Strict typecheck: no new errors (flagged errors verified identical on main via stash comparison).
  • feed.spec.ts + Feed.spec.tsx: 50/50 passing.
  • Not yet smoke-tested in a running browser against the new API (built in parallel with the backend) — recommend a quick local run with the daily-api branch before merge.

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

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)
@vercel

vercel Bot commented Jul 10, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
daily-webapp Ready Ready Preview Jul 10, 2026 1:38pm
1 Skipped Deployment
Project Deployment Actions Updated (UTC)
storybook Ignored Ignored Jul 10, 2026 1:38pm

Request Review

@rebelchris

Copy link
Copy Markdown
Contributor Author

Related PRs (deploy in this order):

  1. dailydotdev/mimir#47 — source_id index migration
  2. feat: add searchSourcePosts query for squad text search daily-api#3996searchSourcePosts GraphQL query
  3. feat: add in-squad post search #6301 — squad page search UI

- 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.
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.

1 participant