Skip to content

Fix active category chip state on Blogs page filtering#3015

Open
singhvibhanshu wants to merge 1 commit into
appwrite:mainfrom
singhvibhanshu:fix-3007
Open

Fix active category chip state on Blogs page filtering#3015
singhvibhanshu wants to merge 1 commit into
appwrite:mainfrom
singhvibhanshu:fix-3007

Conversation

@singhvibhanshu
Copy link
Copy Markdown

Fixes #3007

Signed-off-by: singhvibhanshu <singhvibhanshu@hotmail.com>
@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented May 20, 2026

Greptile Summary

This PR fixes a stale active-chip UI bug on the Blog page where the selected category indicator would not update after browser back/forward navigation or direct URL changes, because selectedCategory was only initialised once from $state.

  • A $effect is added that tracks page.url.searchParams and reassigns selectedCategory on every navigation, keeping the chip highlight in sync with the current URL.
  • The existing "Clear search" flow (selectedCategory = 'Latest'handleSearch()) is unaffected because the effect only re-runs when page.url changes, not when selectedCategory is mutated directly.

Confidence Score: 5/5

Safe to merge — the change is a four-line, isolated addition with no side effects on other page functionality.

The fix is minimal and directly targets the root cause: selectedCategory was initialised once at component creation and never updated when the URL changed. Using $effect is the idiomatic Svelte 5 solution. The Clear search path, pagination, and search handlers are all unaffected.

No files require special attention.

Important Files Changed

Filename Overview
src/routes/blog/[[page]]/+page.svelte Adds a $effect to keep selectedCategory in sync with the URL's category search param on every navigation, fixing the stale chip highlight bug on back/forward navigation.

Reviews (1): Last reviewed commit: "fix(blog): update active category chip U..." | Re-trigger Greptile

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.

On the Blogs page, when filtering the category, the selected chip updates its UI state.

1 participant