-
Hi there, 👋! I'm getting always this error: I created this hook and I'm calling it in the root node of the app to handle the sync. import { useEffect } from 'react'
import { LiveUpdate } from '@capawesome/capacitor-live-update'
export const useAutoUpdater = () => {
useEffect(() => {
window.alert('Auto updater')
const initialize = async () => {
try {
// Mark the app as ready on mount
window.alert('Marking app as ready')
await LiveUpdate.ready()
window.alert('App marked as ready')
// Check for updates
const result = await LiveUpdate.sync()
if (result.nextBundleId) {
window.alert('Update available')
await LiveUpdate.reload()
window.alert('Update applied')
}
} catch (error) {
console.error('Auto update failed:', error)
}
}
initialize()
}, [])
} Am I missing something? Is there any working React example? Thanks for the help and this amazing plugin ❤️ |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
Hi @hugocxl, thank you for creating this discussion! Sadly, I have absolutely no experience with React. The |
Beta Was this translation helpful? Give feedback.
-
Hi @robingenz! Thanks for your quick answer ❤️. Working great now! Thanks again for this great lib and sorry for the inconveniences 🙏 |
Beta Was this translation helpful? Give feedback.
Hi @robingenz! Thanks for your quick answer ❤️.
My bad here 🤦🏻♂️, I generated a first bundle in the cloud service that did not included the
ready
call, therefore never being able to replace that app (even though I was changing the code afterwards).Working great now!
Thanks again for this great lib and sorry for the inconveniences 🙏