Skip to content

fix: add catch fallback to getRandomItems API query on home page load - #306

Merged
RadicalMuffinMan merged 2 commits into
Moonfin-Client:mainfrom
mattsigal:feature/homepage-timeout-fix
Jul 15, 2026
Merged

fix: add catch fallback to getRandomItems API query on home page load#306
RadicalMuffinMan merged 2 commits into
Moonfin-Client:mainfrom
mattsigal:feature/homepage-timeout-fix

Conversation

@mattsigal

@mattsigal mattsigal commented Jul 15, 2026

Copy link
Copy Markdown
Collaborator

This prevents slow database scans from timing out and crashing the entire home page loading sequence.

Pull Request

Summary

This PR resolves a critical startup crash on the browse/home page.

During startup, the client queries for random media items to display as the featured background card at the top of the homepage (api.getRandomItems(...)). On slower servers (like home NAS setups) or large databases, this query frequently takes more than 15 seconds to run, exceeding the client-side timeout limit.

Since this call was previously part of the main Promise.all block without a catch fallback, a timeout on the background card query would abort the entire loader promise, causing the homepage to crash and display "No content found" rather than fallback rows.

Related Issues

Link related issues or tickets separated by commas.

  • Closes #
  • Fixes #
  • Related to #

Type of Change

  • Bug fix
  • New feature
  • Refactor
  • Performance improvement
  • UI/UX update
  • Documentation update
  • Build/CI change
  • Other (describe):

Changes Made

List the key changes included in this PR.

  • Browse.js: Added .catch(() => null) to api.getRandomItems so that slow random backdrop scans do not block or crash the initial loading of critical homepage elements (such as libraries, "Continue Watching", and "Next Up").

  • ModernMediaRow.js: Replaced the React component instance ref wrapper check with a native DOM element query (document.querySelector) and added a fallback type check. This resolves the uncaught TypeError: rowNode.contains is not a function crash that was being thrown in the console whenever focus left a row.

Platform

  • Tizen (Samsung)
  • webOS (LG)
  • Both / Shared code

Testing

Describe how this change was tested.

  • Tested on emulator
  • Tested on physical device
  • Manual testing completed
  • Not tested (explain why):

Test Steps

  1. Open the emulator version of smart tv in browser
  2. Have the home page load :)

Screenshots (if applicable)

Include screenshots or recordings for UI changes.

2026-07-15_10-09-41_chrome

Checklist

  • Code builds successfully
  • Code follows project style and conventions
  • No unnecessary commented-out code
  • No new warnings introduced

This prevents slow database scans from timing out and crashing the entire home page loading sequence.
@github-actions

github-actions Bot commented Jul 15, 2026

Copy link
Copy Markdown

✅ Build Successful

All platform builds passed. You can download the test artifacts below.

Platform Status Artifact
webOS ✅ Passed Moonfin_webOS_*.ipk
Tizen Regular ✅ Passed Moonfin_Tizen_Regular_*.wgt
Tizen Oblong ✅ Passed Moonfin_Tizen_Oblong_*.wgt
Tizen Legacy ✅ Passed Moonfin_Tizen_Legacy_*.wgt
Property Value
Commit 98a36f2
Workflow run Build #154

@mattsigal

Copy link
Copy Markdown
Collaborator Author

Updated the PR to also address this mess:
2026-07-15_10-17-38_chrome

@RadicalMuffinMan
RadicalMuffinMan merged commit 33a29e8 into Moonfin-Client:main Jul 15, 2026
5 checks passed
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.

2 participants