feat: add auto-refresh interval option#1149
Closed
chindris-mihai-alexandru wants to merge 1 commit intotw93:mainfrom
Closed
feat: add auto-refresh interval option#1149chindris-mihai-alexandru wants to merge 1 commit intotw93:mainfrom
chindris-mihai-alexandru wants to merge 1 commit intotw93:mainfrom
Conversation
Add a new --refresh-interval CLI option that reloads the packaged page on a fixed interval. The injected runtime defers refreshes while the page is hidden or while the user is focused in editable fields so dashboards and news pages can stay fresh without disrupting active input.
99048d4 to
5c84e18
Compare
Owner
|
@chindris-mihai-alexandru Thanks for the PR. I do not think this should be a built-in Pake option. Pake already supports setInterval(() => {
const el = document.activeElement;
const editing =
el &&
(el.isContentEditable ||
["INPUT", "TEXTAREA", "SELECT"].includes(el.tagName));
if (!document.hidden && !editing) {
window.location.reload();
}
}, 300000);I think this is better as documentation, not core behavior. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
--refresh-intervalCLI option to reload the packaged page on a fixed intervalCloses #1146
Why
Some packaged sites such as news pages or dashboards do not refresh themselves automatically, and manually pressing reload is inconvenient. This adds an opt-in refresh interval directly in Pake instead of requiring external automation.
Behavior
0(disabled)input,textarea,select, orcontenteditablefield, refresh is deferredFiles changed
bin/types.ts- addrefreshIntervalandrefresh_intervalconfig fieldsbin/defaults.ts- default interval of0bin/helpers/cli-program.ts- register--refresh-interval <number>bin/helpers/merge.ts- write interval into generatedpake.jsonsrc-tauri/src/app/config.rs- deserializerefresh_intervalsrc-tauri/src/inject/event.js- implement deferred timed reload behaviorsrc-tauri/pake.json- template defaulttests/unit/cli-options.test.ts- CLI option testdocs/cli-usage.md- usage docsValidation
pnpm run cli:buildnpx vitest run tests/unit/cli-options.test.tscargo checkPAKE_CREATE_APP=1and verified generated.pake/pake.jsoncontains"refresh_interval": 120