[PR #165] [MERGED] Add a "refresh app" button to advanced settings to force a refresh from within client #4489

Closed
opened 2026-10-22 04:08:04 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/165
Author: @amauragis
Created: 4/21/2026
Status: ✅ Merged
Merged: 4/21/2026
Merged by: @SpicyMarinara

Base: main ← Head: force-refresh-btn


📝 Commits (1)

  • 437b694 Add forced refresh button

📊 Changes

5 files changed (+94 additions, -21 deletions)

View changed files

📝 packages/client/src/App.tsx (+5 -7)
📝 packages/client/src/components/panels/SettingsPanel.tsx (+42 -0)
📝 packages/client/src/hooks/use-chats.ts (+1 -1)
➕ packages/client/src/lib/browser-runtime.ts (+46 -0)
➖ packages/client/src/lib/cache-reset.ts (+0 -13)

📄 Description

This pull request refactors and improves the app’s logic for clearing browser caches and unre/gistering service workers, centralizing this functionality in a new browser-runtime module. It also introduces a user-facing "Refresh App" button in the advanced settings panel, allowing users to manually clear caches and force a SPA reload without losing local data.

The reason for adding the manual refresh is to allow pinned SPAs on iOS to be refreshed (as they wouldn't have access to a refresh button.

What changed

**Browser runtime and cache management improvements:

  • Created a new browser-runtime module (browser-runtime.ts) that provides clearBrowserRuntimeCaches and a new forceRefreshSpa function, both of which handle unregistering service workers and clearing all browser caches in a robust, reusable way.
  • Removed the old clearBrowserRuntimeCaches implementation from cache-reset.ts, consolidating all related logic in the new module.
  • Updated all imports and usages of clearBrowserRuntimeCaches and related cache management to use the new browser-runtime module across the codebase (App.tsx, use-chats.ts). [1] [2]

User interface enhancements:

  • Added a "Refresh App" button to the advanced settings panel, which calls forceRefreshSpa to clear caches and reload the app. The button provides user feedback and disables itself during the refresh operation to prevent duplicate actions. [1] [2] [3]
  • Provided a tooltip explaining that the refresh will clear caches and unregister service workers without affecting local app data like chats and settings.

Version recovery improvements:

  • Updated the version recovery logic in App.tsx to use forceRefreshSpa, ensuring consistent cache-clearing and reload behavior when recovering from version mismatches.## Why this change

Validation

  • pnpm check
  • Manual verification completed (describe below)

Manual verification notes

  • Verified refresh action works to catch stale versions still.

Docs and release impact

  • No docs changes needed

UI evidence (if applicable)

image

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Pasta-Devs/Marinara-Engine/pull/165 **Author:** [@amauragis](https://github.com/amauragis) **Created:** 4/21/2026 **Status:** ✅ Merged **Merged:** 4/21/2026 **Merged by:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Base:** `main` ← **Head:** `force-refresh-btn` --- ### 📝 Commits (1) - [`437b694`](https://github.com/Pasta-Devs/Marinara-Engine/commit/437b6948e567d8cb4fa6f6cac5d5842a25ab65a8) Add forced refresh button ### 📊 Changes **5 files changed** (+94 additions, -21 deletions) <details> <summary>View changed files</summary> 📝 `packages/client/src/App.tsx` (+5 -7) 📝 `packages/client/src/components/panels/SettingsPanel.tsx` (+42 -0) 📝 `packages/client/src/hooks/use-chats.ts` (+1 -1) ➕ `packages/client/src/lib/browser-runtime.ts` (+46 -0) ➖ `packages/client/src/lib/cache-reset.ts` (+0 -13) </details> ### 📄 Description This pull request refactors and improves the app’s logic for clearing browser caches and unre/gistering service workers, centralizing this functionality in a new `browser-runtime` module. It also introduces a user-facing "Refresh App" button in the advanced settings panel, allowing users to manually clear caches and force a SPA reload without losing local data. The reason for adding the manual refresh is to allow pinned SPAs on iOS to be refreshed (as they wouldn't have access to a refresh button. ## What changed **Browser runtime and cache management improvements: * Created a new `browser-runtime` module (`browser-runtime.ts`) that provides `clearBrowserRuntimeCaches` and a new `forceRefreshSpa` function, both of which handle unregistering service workers and clearing all browser caches in a robust, reusable way. * Removed the old `clearBrowserRuntimeCaches` implementation from `cache-reset.ts`, consolidating all related logic in the new module. * Updated all imports and usages of `clearBrowserRuntimeCaches` and related cache management to use the new `browser-runtime` module across the codebase (`App.tsx`, `use-chats.ts`). [[1]](diffhunk://#diff-ec2dc392bcf26c2a7c1a34631db8a5f5d220596d2e986f8959acaa22494fcb78L15-R15) [[2]](diffhunk://#diff-40da0e77f8d75369325c81ec79a76c6da1731de0eb1fa05ea4605c6b14501663L11-R11) **User interface enhancements:** * Added a "Refresh App" button to the advanced settings panel, which calls `forceRefreshSpa` to clear caches and reload the app. The button provides user feedback and disables itself during the refresh operation to prevent duplicate actions. [[1]](diffhunk://#diff-481a4eafdeb94a9514ea35b2da8b51aec930349aced4e258ea01c476937c1f6eR1923) [[2]](diffhunk://#diff-481a4eafdeb94a9514ea35b2da8b51aec930349aced4e258ea01c476937c1f6eR1945-R1960) [[3]](diffhunk://#diff-481a4eafdeb94a9514ea35b2da8b51aec930349aced4e258ea01c476937c1f6eR2240-R2263) * Provided a tooltip explaining that the refresh will clear caches and unregister service workers without affecting local app data like chats and settings. **Version recovery improvements:** * Updated the version recovery logic in `App.tsx` to use `forceRefreshSpa`, ensuring consistent cache-clearing and reload behavior when recovering from version mismatches.## Why this change ## Validation - [x] `pnpm check` - [x] Manual verification completed (describe below) ### Manual verification notes - Verified refresh action works to catch stale versions still. ## Docs and release impact - [x] No docs changes needed ## UI evidence (if applicable) <img width="363" height="470" alt="image" src="https://github.com/user-attachments/assets/69ac6b94-6f84-4093-a7b0-3e41696391ca" /> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-22 04:08:04 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Pasta-Devs/Marinara-Engine#4489
No description provided.