Skip to content

Improve download strategy - #81

Merged
DocMoebiuz merged 5 commits into
mainfrom
63/improve-downlad-strategy
Oct 2, 2026
Merged

DocMoebiuz merged 5 commits into
mainfrom
63/improve-downlad-strategy

Conversation

@DocMoebiuz

@DocMoebiuz DocMoebiuz commented Oct 2, 2026 •

Copy link
Copy Markdown
Contributor

This PR focuses on avoiding / reducing unnecessary fetches of presets.

  • Only download the full preset list for the currently selected sim type (MSFS by default). X-Plane is downloaded the first time a user switches to it.
  • Stats page reuses the locally stored preset list instead of downloading it on every visit. X-Plane users no longer download both lists there.
  • Detail view fetches only the single preset (GET /{sim}/presets/{id}) instead of the entire preset list.

Notes

  • New services/presetSync.ts with syncSim(sim), shared by the presets and stats pages.
  • It downloads a sim's list only if the local copy is empty or the server has a newer "last changed" date.
  • The stored date now comes from the server, not the user's clock. Existing users fall back to their old stored date, so they won't download everything again after this update.
  • The loading spinner no longer gets stuck when the update check fails.
  • Opening the "Add preset" dialog no longer triggers a check; closing it checks once.
  • Detail view: shared links and the history now load reliably. It shows a loading state instead of briefly saying "preset does not exist".

out of scope

  • Avoiding the full download after a user's own edit, add or revert.
  • Fixing revert, which doesn't update the local copy correctly.
  • Incremental updates (only downloading what changed). This needs API changes.

Copilot AI balanced review requested due to automatic review settings October 2, 2026 17:27
@github-actions

github-actions Bot commented Oct 2, 2026

Copy link
Copy Markdown

Azure Static Web Apps: Your stage site is ready! Visit it here: https://green-grass-06127b803-81.westeurope.1.azurestaticapps.net

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot review overview

🟡 Changes recommended

Freshness comparisons and detail-page loading/error handling can produce stale or incorrect results.

Review effort: Balanced
Findings: 1 High severity · 5 Medium severity

Open (6)
What changed in this PR

Centralizes preset synchronization to reduce unnecessary API requests and load only simulator-specific data.

Changes:

  • Adds IndexedDB-backed, per-simulator synchronization.
  • Fetches individual presets on detail pages.
  • Updates stats and preset views to use cached data.
File Description
services/​presetSync.ts Adds centralized preset synchronization.
pages/​stats.tsx Loads data for the selected simulator.
pages/​preset.tsx Fetches and caches individual presets.
components/​sections/​presets/​singlePresetView/​PresetView.tsx Supports pending preset state.
components/​sections/​presets/​Presets.tsx Replaces duplicate download logic with synchronization.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread services/presetSync.ts Resolved
Comment thread pages/preset.tsx Resolved
Comment thread pages/preset.tsx Resolved
Comment thread pages/preset.tsx Resolved
Comment thread services/presetSync.ts Resolved
@github-actions

github-actions Bot commented Oct 2, 2026

Copy link
Copy Markdown

Azure Static Web Apps: Your stage site is ready! Visit it here: https://green-grass-06127b803-81.westeurope.1.azurestaticapps.net

@DocMoebiuz
DocMoebiuz merged commit b41c8a5 into main Oct 2, 2026
2 checks passed
@DocMoebiuz DocMoebiuz changed the title Improve downlad strategy Improve download strategy Oct 2, 2026
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.

2 participants