-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Code push - Bundle changes are not reflected once the App closes and reopens #2529
Comments
same here |
same here, I'm not sure if this information is relevant, but the code push was functioning correctly for me when the "react-native" version was 0.68.2. However, I needed to add a new feature that required upgrading "react-native" to at least version 0.69.1. To perform the upgrade, I used the upgrade helper provided by https://react-native-community.github.io/upgrade-helper/?from=0.68.2&to=0.69.1. After publishing the app about 2 months ago, when I tried to do the code push last week, the code push is no longer working as expected. The issue is that after a successful code push, the app prompts for an upgrade, and upon installation, it functions properly. However, when I close and reopen the app, it reverts back to the previous version. |
@karthinidc , @namcancode , can you also confirm if the issues started to happen after RN upgrade? |
@DmitriyKirakosyan It's a new project, Created the React Native version with 0.69.0. -- Not did any RN upgrade |
Same here, |
@DmitriyKirakosyan kindly ask if there is any thought of this issue? |
Please make sure you have correctly set up CodePush in AppDelegate.mm, see https://learn.microsoft.com/en-us/appcenter/distribution/codepush/rn-get-started#ios-setup. Let me know if it helps. |
@DmitriyKirakosyan Facing the same issue on only iOS. Is there any way? Environmentreact-native-code-push version: ^8.0.1 AppDelegate.mm#import "AppDelegate.h"
#import "SDImageCodersManager.h"
#import <SDWebImageWebPCoder/SDImageWebPCoder.h>
#import <React/RCTAppSetupUtils.h>
#import <React/RCTBundleURLProvider.h>
#import <CodePush/CodePush.h>
@implementation AppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
[FIRApp configure];
self.moduleName = @"";
self.initialProps = @{};
return [super application:application didFinishLaunchingWithOptions:launchOptions];
}
- (NSURL *)sourceURLForBridge:(RCTBridge *)bridge
{
#if DEBUG
return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index"];
#else
return [CodePush bundleURL];
#endif
}
- (BOOL)concurrentRootEnabled
{
return true;
}
@end |
Hi @uncoolclub , may I ask you to reproduce the issue on an empty app and share it with us if possible? |
I apologize, but I cannot spend much time on this due to other tasks, so I cannot test in an empty app. Instead, I'll tell you more about the current environment. The log I observed in the Xcode console is as follows, and along with this log, the app stays on the previous version without receiving the latest update: [CodePush] Loading JS bundle from file:///var/mobile/Containers/Data/Application/A90206B2-BDA2-4527-8E1F-A1F643C499D1/Library/Application%20Support/CodePush/36f844ae1b550aa78f08b8b60db98b3c2f6fae660950830df0cb5f2a5e390f69/CodePush/main.jsbundle // App.jsx
import React, { lazy, Suspense, useEffect } from 'react';
import LoadingScreen from '@Loading/LoadingScreen';
// import other modules
const codePushOptions = { checkFrequency: codePush.CheckFrequency.MANUAL };
const screenOptions = {
headerShown: false,
gestureEnabled: PLATFORM.CURRENT === PLATFORM.IOS,
cardStyleInterpolator: CardStyleInterpolators.forHorizontalIOS,
};
const queryClient = new QueryClient();
const Stack = createNativeStackNavigator();
const App = () => {
...
return (
<Provider store={store}>
<QueryClientProvider client={queryClient}>
<Suspense fallback={<View />}>
<NavigationContainer>
<Stack.Navigator screenOptions={screenOptions}>
...
</Stack.Navigator>
</NavigationContainer>
</Suspense>
</QueryClientProvider>
</Provider>
);
};
export default codePush(codePushOptions)(App); // LoadingScreen.jsx
...
syncWithCodePush = async () => {
const [isTester, isBetaTester] = await Promise.all([getIsTester(true), getIsBetaTester()]);
this.setRandomProcessText();
return new Promise((resolve) => {
const option = { installMode: InstallMode.IMMEDIATE };
if (isTester) {
option.deploymentKey = TEST_DEPLOYMENT_KEY;
} else if (isBetaTester) {
option.deploymentKey = BETA_TEST_DEPLOYMENT_KEY;
} else {
option.deploymentKey = PROD_DEPLOYMENT_KEY;
}
const loadingTimeout = setTimeout(() => {
this.setState({ isCodeUpdated: true, isOnSync: false });
resolve(true);
}, 13000);
sync(
option,
(status) => {
switch (status) {
case SyncStatus.CHECKING_FOR_UPDATE:
console.log('[CodePush] Checking for updates.');
break;
case SyncStatus.UP_TO_DATE:
console.log('[CodePush] Up-to-date.');
this.setState({
isOnSync: false,
isCodeUpdated: true,
totalBytes: 100,
receivedBytes: 100,
});
clearTimeout(loadingTimeout);
resolve(true);
break;
case SyncStatus.UPDATE_INSTALLED:
console.log('[CodePush] Update installed.');
this.setState({
isOnSync: false,
isCodeUpdated: true,
totalBytes: 100,
receivedBytes: 100,
});
clearTimeout(loadingTimeout);
break;
case SyncStatus.INSTALLING_UPDATE:
console.log('[CodePush] Installing update.');
this.setState({
isOnSync: false,
isCodeUpdated: true,
totalBytes: 100,
receivedBytes: 100,
});
clearTimeout(loadingTimeout);
break;
case SyncStatus.DOWNLOADING_PACKAGE:
console.log('[CodePush] Downloading package.');
this.setState({ isOnSync: true });
clearTimeout(loadingTimeout);
break;
default:
break;
}
},
({ receivedBytes, totalBytes }) => {
this.setState({ receivedBytes, totalBytes, isOnSync: true });
if (receivedBytes >= totalBytes) {
this.setRandomProcessText();
}
},
);
});
}; Also, there was no problem when I used the version below, but there was an issue while upgrading the version. // prev version
"react": "17.0.2",
"react-native": "0.68.0",
"react-native-code-push": "^7.0.5" // current version
"react": "18.2.0",
"react-native": "0.71.6",
"react-native-code-push": "^8.0.1" If you have a plan to work on this bug, can I know when it can be fixed? |
@DmitriyKirakosyan Hi, Can you check it ASAP? It's about to be released, so I need to check it quickly. Help me, please. 🥺🥺 |
I can't see any additional attachments. Or you meant the video? A couple of additional questions:
|
@DmitriyKirakosyan |
@uncoolclub Unfortunately the video and the flow steps didn't help me to find the root cause. |
Hi I'm having the same issues except mine is a complete starter application. When new update is released to codepush the app prompts with the install button, once I click install no changes happen, but on the appcenter it shows its been downloaded and installed. Already reinstalled twice double checking correct gradle and java getJSBundleFile override. import React from 'react';
import type {PropsWithChildren} from 'react';
import {
SafeAreaView,
ScrollView,
StatusBar,
StyleSheet,
Text,
useColorScheme,
View,
} from 'react-native';
import codePush from 'react-native-code-push';
const codePushOptions = {
updateDialog: true,
checkFrequency: codePush.CheckFrequency.ON_APP_START,
installMode: codePush.InstallMode.IMMEDIATE,
};
type SectionProps = PropsWithChildren<{
title: string;
}>;
function Section({children, title}: SectionProps): JSX.Element {
const isDarkMode = useColorScheme() === 'dark';
return (
<View style={styles.sectionContainer}>
<Text
style={[
styles.sectionTitle,
{
color: isDarkMode ? 'white' : 'black',
},
]}>
{title}
</Text>
<Text
style={[
styles.sectionDescription,
{
color: isDarkMode ? 'lightgray' : 'gray',
},
]}>
{children}
</Text>
</View>
);
}
function App(): JSX.Element {
const isDarkMode = useColorScheme() === 'dark';
const backgroundStyle = {
backgroundColor: isDarkMode ? 'black' : 'white',
};
return (
<SafeAreaView style={backgroundStyle}>
<StatusBar
barStyle={isDarkMode ? 'light-content' : 'dark-content'}
backgroundColor={backgroundStyle.backgroundColor}
/>
<ScrollView
contentInsetAdjustmentBehavior="automatic"
style={backgroundStyle}>
<View
style={{
backgroundColor: isDarkMode ? 'black' : 'white',
}}>
<Section title="Driver App">
<Text style={styles.highlight}>
Over-The-Air Updates Mockup{'\n'}
</Text>
<Text style={styles.baseText}>This is version 2.0.0</Text>
</Section>
<Section title="Testing Changes">
<Text style={styles.highlight}>
I added text here for version 2.0.0
</Text>
</Section>
</View>
</ScrollView>
</SafeAreaView>
);
}
const styles = StyleSheet.create({
baseText: {
fontFamily: 'Cochin',
fontStyle: 'italic',
},
sectionContainer: {
marginTop: 32,
paddingHorizontal: 24,
},
sectionTitle: {
fontSize: 24,
fontWeight: '600',
},
sectionDescription: {
marginTop: 8,
fontSize: 18,
fontWeight: '400',
},
highlight: {
fontWeight: '700',
},
});
export default codePush(codePushOptions)(App);
|
This helped me #2195 (comment). I had a similar issue. |
Hello, facing the same issue on iOS only
iPad OS Version 16.5.1 Update: In our case this seems to have fixed it |
Same here Latest React native & code push |
@mhatami-ecotrak , have you tried the fix from #2195 (comment)? |
I'm still facing the same issue in 2k24. Any solutions or workaround for this? |
I am facing the same issue on iOS right now. (Android works without a problem.) ( -> Codepush is loading the update after starting the app, restarting and showing the changes. After restarting the app manually, the original bundle is showing again. No information in xCode logs. ) I am not using react-native-navigation by wix. Therefore the workaround doesn't work for me.
My AppDelegate.mm looks like the following:
@DmitriyKirakosyan Do you see anything out of the ordinary here? Maybe it is the RNBootSplash implementation? The rest of my code is fairly simple: main.tsx (which is called by index.js with AppRegistry.registerComponent)
and inside my loading-component:
|
Any update on this? facing the same on Android. It's loading the bundle from codepush index.bundle.js but not reflecting the changes in android. |
@ishiharas, your code snippet appears fine. Could you please create a minimal demo application to replicate the issue? @tgp-fk, I have the same request for you. |
same here |
hey @Bruce-Ming it's better to leave this code push now as it will be deprecated next year. It's Better to wait for a standalone version by MS. |
"react": "17.0.2", I pushed code with this: When the 'Just Now' changes to the Date Time. I Enabled the release and when I open the TestFlight, it downloads the update after 1-2 minutes and changes reflect on the next restart. Today, I tested it 2 times on my TestFlight, it's working. Suppose any issue comes up once my app is uploaded via the App Store. I will let you people know.
|
i got same issue. The first time it worked but i don't understand why when i close the app and reopen it it goes back to the original |
@nguyenductoan1995 please share the app logs and a demo app to reproduce the issue on if possible. |
@DmitriyKirakosyan |
Hi @nguyenductoan1995 i can't reproduce the issue you are experiencing could you please share a small demo app in which this issue is reproducable? |
Code push - Bundle changes are not reflected once the App closes and reopens only. (iOS Platform), Android working fine.
Steps to Reproduce
Expected Behavior
Always available the new bundle release on the screen
Actual Behavior
Always not available the new bundle release on the screen
Environment
(The more info the faster we will be able to address it!)
The text was updated successfully, but these errors were encountered: