Skip to content

feat: Server-side rendered explore page#5443

Merged
steverydz merged 7 commits intomainfrom
explore-page-ssr
Oct 28, 2025
Merged

feat: Server-side rendered explore page#5443
steverydz merged 7 commits intomainfrom
explore-page-ssr

Conversation

@steverydz
Copy link
Copy Markdown
Contributor

@steverydz steverydz commented Oct 28, 2025

Done

Converts the explore page from a client-side rendered app to a server-side rendered page. There's a couple of minor visual differences which I've asked Leia about in chat - but otherwise they should be identical.

How to QA

Testing

  • This PR has tests
  • No testing required (explain why):

Copilot AI review requested due to automatic review settings October 28, 2025 08:45
@webteam-app
Copy link
Copy Markdown

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 migrates the explore page from a client-side React application to server-side rendering (SSR) using Flask templates. The backend now fetches recommendations data (popular, recent, trending snaps) and categories, passing them to Jinja2 templates instead of loading them via React and React Query.

Key Changes

  • Backend now handles data fetching for popular/recent/trending snaps and categories in explore_view()
  • React components replaced with Jinja2 templates for rendering snap lists and categories
  • Client-side routing removed for /explore endpoint

Reviewed Changes

Copilot reviewed 28 out of 28 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
webapp/store/views.py Adds server-side data fetching logic for explore page with API calls to recommendations service
tests/store/tests_explore.py New unit tests for recommendations API endpoints
templates/explore/index.html Main explore page template structure
templates/explore/_updated-snaps.html Template partial for recently updated snaps section
templates/explore/_popular-snaps.html Template partial for most popular snaps section
templates/explore/_trending-snaps.html Template partial for trending snaps section
templates/explore/_categories.html Template partial for categories section
static/sass/styles.scss Adds styling for explore page highlight block and updates line-clamp utility
static/js/store/index.tsx Removes /explore route from React Router
static/js/store/pages/Explore/* Removes all React components and tests for client-side explore page
static/js/store/utils/formatCardData.ts Removes utility no longer needed after SSR migration
static/js/store/types/* Removes unused TypeScript types
static/js/store/hooks/* Removes unused React hooks

Comment thread webapp/store/views.py Outdated
Comment on lines +136 to +150
except StoreApiError:
popular_snaps = []

try:
recent_snaps = api_requests.get(
f"{recommendations_api_url}/recent"
).json()
except StoreApiError:
recent_snaps = []

try:
trending_snaps = api_requests.get(
f"{recommendations_api_url}/trending"
).json()
except StoreApiError:
Copy link

Copilot AI Oct 28, 2025

Choose a reason for hiding this comment

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

API request exceptions are caught as StoreApiError, but api_requests.get() (which is requests.get()) raises requests.exceptions.RequestException or its subclasses, not StoreApiError. The except block will never catch these exceptions. Either catch the correct exception type or ensure the code raises StoreApiError.

Suggested change
except StoreApiError:
popular_snaps = []
try:
recent_snaps = api_requests.get(
f"{recommendations_api_url}/recent"
).json()
except StoreApiError:
recent_snaps = []
try:
trending_snaps = api_requests.get(
f"{recommendations_api_url}/trending"
).json()
except StoreApiError:
except api_requests.exceptions.RequestException:
popular_snaps = []
try:
recent_snaps = api_requests.get(
f"{recommendations_api_url}/recent"
).json()
except api_requests.exceptions.RequestException:
recent_snaps = []
try:
trending_snaps = api_requests.get(
f"{recommendations_api_url}/trending"
).json()
except api_requests.exceptions.RequestException:

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think it would make sense to add some recommendation service helpers to the store-api package at some point in the future, that way we can handle these errors without relying on RequestException

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I agree. I'll make a ticket.

Comment thread templates/explore/_updated-snaps.html
Comment thread templates/explore/_popular-snaps.html
Comment thread templates/explore/_popular-snaps.html
Copy link
Copy Markdown
Contributor

@edisile edisile left a comment

Choose a reason for hiding this comment

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

Looks good!

@steverydz steverydz merged commit f7b92db into main Oct 28, 2025
13 checks passed
@steverydz steverydz deleted the explore-page-ssr branch October 28, 2025 15:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants