2.0.2 • Published 6 months ago
check-appn-version v2.0.2
Reload Dialog Module
This module renders a dialog to reload the application if there is a version update.
Props
Prop Name | Type | Default Value | Description |
---|---|---|---|
label | string | '' | Custom label for the dialog |
onClick | func | null | Callback function triggered on button click |
btnName | string | 'Reload' | Text displayed on the reload button |
currentVersion | string | '' | Current version of the application |
fileName | string | '' | Name of the file to check for version updates |
dialogInactivityTimeout | number | 180000 (3 mins) | Timeout for dialog inactivity |
defaultAutoRefreshTime | number | 600000 (10 mins) | Frequency of version check API calls |
How It Works
- The module makes an API call to
domain/${fileName}
everydefaultAutoRefreshTime
milliseconds. - Ensure this route exists in your backend app and returns an object in the format (application/json):
{ "version": "x.y" }
- The module compares the received version with the
currentVersion
prop. - If there is a mismatch, a dialog appears prompting the user to reload the page.
Usage
<ReloadDialog
currentVersion="1.0.0"
fileName="version.json"
btnName="Update Now"
dialogInactivityTimeout={180000}
defaultAutoRefreshTime={600000}
/>
Ensure your backend serves the version information at domain/version.json
to support this functionality.