Skip to content

fix: Detect script changes from remote repository to allow Script updates#348

Merged
michelroegl-brunner merged 2 commits intomainfrom
fix/update_script
Nov 26, 2025
Merged

fix: Detect script changes from remote repository to allow Script updates#348
michelroegl-brunner merged 2 commits intomainfrom
fix/update_script

Conversation

@michelroegl-brunner
Copy link
Copy Markdown
Member

Problem

When a user loads a script from the default repo, it works fine. However, when the script changes in the remote repository (GitHub), the user doesn't get notified and cannot update. This happens because:

  1. The compareScriptContent query is cached by React Query (default staleTime: 30s)
  2. When the modal reopens, it uses cached comparison results instead of checking the remote repository for changes
  3. The comparison logic correctly downloads fresh content from GitHub, but the query cache prevents it from running

Solution

  • Added refetchOnMount: true and staleTime: 0 to compareScriptContent query to bypass React Query cache
  • Added visible refresh button in script detail modal to manually check for updates
  • Improved comparison error handling and logging for better debugging
  • Display error messages in UI when comparison fails

Changes

  • src/app/_components/ScriptDetailModal.tsx: Updated query options and added refresh button
  • src/server/services/scriptDownloader.js: Added comprehensive logging and improved error handling

- Add refetchOnMount and staleTime: 0 to compareScriptContent query to bypass React Query cache
- Add visible refresh button in script detail modal to manually check for updates
- Improve comparison error handling and logging for better debugging
- Display error messages in UI when comparison fails
- Ensure comparison always checks remote repository when modal opens
@michelroegl-brunner michelroegl-brunner changed the title fix: Detect script changes from remote repository fix: Detect script changes from remote repository to allow Script updates Nov 26, 2025
@michelroegl-brunner michelroegl-brunner merged commit 2a9921a into main Nov 26, 2025
3 of 4 checks passed
@MickLesk MickLesk deleted the fix/update_script branch April 1, 2026 11:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants