Skip to content
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

Change object not emitted when observed property had changed to null #86

Open
pkrysztofiak opened this issue Mar 26, 2019 · 0 comments
Open

Comments

@pkrysztofiak
Copy link

pkrysztofiak commented Mar 26, 2019

import io.reactivex.rxjavafx.observables.JavaFxObservable;
import javafx.application.Application;
import javafx.beans.property.SimpleStringProperty;
import javafx.beans.property.StringProperty;
import javafx.stage.Stage;

public class ChangesOfNullApp extends Application {

	public static void main(String[] args) {
		launch(args);
	}

	@Override
	public void start(Stage stage) throws Exception {
		StringProperty stringProperty = new SimpleStringProperty("firstValue");

		JavaFxObservable.changesOf(stringProperty)
		.subscribe(change -> System.out.println("oldValue=" + change.getOldVal() + ", newValue=" + change.getNewVal()));

		stringProperty.set(null);
		stringProperty.set("secondValue");
		stringProperty.set("thirdValue");
	}
}

The output is:
oldValue=null, newValue=secondValue
oldValue=secondValue, newValue=thirdValue
Imo there is first missing emission which should be logged as:
oldValue=firstValue, newValue=null
Generally there are no change emissions when property was set to null.

@pkrysztofiak pkrysztofiak changed the title Change object not emitted when observed property changed to null Change object not emitted when observed property had changed to null Mar 26, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant