react-native-code-push icon indicating copy to clipboard operation
react-native-code-push copied to clipboard

no rollback when not call notifyAppReady

Open fatfatson opened this issue 8 years ago • 6 comments

Steps to Reproduce

1.query&download&install an update manually 2.restart app 3.getUpdateMetadata shows current is in the new version

Expected Behavior

according to the docs, it should be rollbacked if I install update manually and don't call notifyAppReady.

Actual Behavior

rollback not happen.

Reproducible Demo

async startUpdate() {
		if (!this.state.localPackage) {
			//this.setState({ showUpdating: true });
			var localPackage = await this.state.availableUpdate.download(({ receivedBytes, totalBytes }) => {
				console.log(receivedBytes, totalBytes);
				if (this._isUnmount) return;
				this.setState({
					downloadProgress: receivedBytes / totalBytes,
				});
			});

			if (this._isUnmount) return;
			console.log('download ok', localPackage);
			this.setState({ localPackage });
		}

		if (this._isUnmount) return;
		var ok = await this.waitAlert();
		if (!ok) return;

		await this.state.localPackage.install();
		console.log('install ok!');
	}

Environment

  • react-native-code-push version:^5.2.0-beta
  • react-native version:^0.51.0
  • iOS/Android/Windows version:Android 7.0 API24
  • Does this reproduce on a debug build or release build? All
  • Does this reproduce on a simulator, or only on a physical device? All

fatfatson avatar Jan 30 '18 12:01 fatfatson

Hi @fatfatson, Thanks fo reporting! Could you please attach archive with sample project to reproduce?

Thanks!

itoys avatar Feb 15 '18 16:02 itoys

Hi @fatfatson, Is the issue still relevant for you?

NickToropov avatar May 14 '18 12:05 NickToropov

Hi @fatfatson, I’ll close this issue for now, please open it again if there are any questions.

NickToropov avatar May 22 '18 12:05 NickToropov

yes it still exist, but now I'm using the builtin sync method to workaround it.

fatfatson avatar May 22 '18 14:05 fatfatson

Hi @fatfatson, I've reproduced you issue. The point is that notifyAppReady method is called in componentDidMount method: https://github.com/Microsoft/react-native-code-push/blob/163e2b5b8d1fd0b6967507444881ebd6ceb7f0f3/CodePush.js#L464

I tried to comment this line and my update rolled back to previous version.

Please, let me know if it was helpful for you.

NickToropov avatar May 23 '18 14:05 NickToropov

Hi @fatfatson, I hope my clarification was helpful for you, will close this issue for now. Please open it again if there are any questions.

NickToropov avatar May 30 '18 07:05 NickToropov