Skip to content

Commit

Permalink
add info param to switchversion
Browse files Browse the repository at this point in the history
  • Loading branch information
sunnylqm committed Jul 23, 2024
1 parent 7780f99 commit 13d8cf7
Showing 1 changed file with 16 additions and 10 deletions.
26 changes: 16 additions & 10 deletions src/provider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,17 +62,23 @@ export const PushyProvider = ({
[options.updateStrategy],
);

const switchVersion = useCallback(() => {
if (updateInfo && updateInfo.hash) {
client.switchVersion(updateInfo.hash);
}
}, [client, updateInfo]);
const switchVersion = useCallback(
(info: CheckResult | undefined = updateInfoRef.current) => {
if (info && info.hash) {
client.switchVersion(info.hash);
}
},
[client],
);

const switchVersionLater = useCallback(() => {
if (updateInfo && updateInfo.hash) {
client.switchVersionLater(updateInfo.hash);
}
}, [client, updateInfo]);
const switchVersionLater = useCallback(
(info: CheckResult | undefined = updateInfoRef.current) => {
if (info && info.hash) {
client.switchVersionLater(info.hash);
}
},
[client],
);

const downloadUpdate = useCallback(
async (info: CheckResult | undefined = updateInfoRef.current) => {
Expand Down

0 comments on commit 13d8cf7

Please sign in to comment.