-
Notifications
You must be signed in to change notification settings - Fork 26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: improve app creation realtime management #1931
Conversation
BundleMonFiles updated (2)
Unchanged files (11)
Total files change +286B +0.01% Final result: ✅ View report in BundleMon website ➡️ |
02e0c55
to
8e2fcae
Compare
src/components/AppTile.jsx
Outdated
} | ||
|
||
export default translate()(AppTile) | ||
export default translate()(AppTileWrapper) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tu peux dégager le hoc pour utiliser un useI18n()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done ✅
src/queries.js
Outdated
|
||
export const fetchAppInfo = async (appId, client) => { | ||
const appQuery = Q('io.cozy.apps').getById(appId) | ||
const { data } = await client.query(appQuery, { as: 'fetchAppInfoReady' }) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tu ne peux pas appeler ton alias (as
) ainsi parce que tout le cache de cozy-client est basé sur ce as
...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Corrigé ✅
Introduce AppTileWrapper component to handle installing state on realtime app installation
8e2fcae
to
7fa57fd
Compare
Fix AppTile not updating when app state changes from 'installing' to 'ready'
Issue:
The AppTile component was not correctly updating when an app's state changed from
'installing'
to'ready'
. This resulted in the app icon staying as a placeholder forever in persistent scenarios (native).Solution:
To resolve this issue, we introduced a new wrapper component,
AppTileWrapper
, responsible for managing the app's state and fetching the app's information when the state changes from'installing'
to'ready'
. TheAppTileWrapper
component utilizes auseEffect
hook to detect the change in the app's state and fetch the updated app information accordingly.When the app's information is unavailable (i.e., the app is in the
'installing'
state),AppTileWrapper
renders a loading icon using theSquareAppIcon
component. Once the app's state changes to'ready'
and the information is fetched,AppTileWrapper
renders theAppTile
component, displaying the app icon with a link to the app.Additionally, we updated the test suite to cover the new component behaviour, ensuring that the
AppTile
is rendered when the app is in the'ready'
state and updates when the app's state transitions from'installing'
to'ready'
.With these changes, the
AppTile
component now correctly updates its state and displays the correct information when an app's state changes from'installing'
to'ready'
.Video example:
Android.Emulator.-.Nexus_5X_API_30_5554.2023-04-24.17-29-26.mp4