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

Maintain value after dismiss modal #95

Open
shifenis opened this issue Dec 29, 2021 · 0 comments
Open

Maintain value after dismiss modal #95

shifenis opened this issue Dec 29, 2021 · 0 comments

Comments

@shifenis
Copy link

shifenis commented Dec 29, 2021

As the title described, the modal should not remove the value while closing the modal: from the UX point of view, the user expects the X button will not delete his previous selection, but just dismiss the modal. I know there is a backButton, but even in this case, a modal (so a page that came from bottom to top) without navigation should not have a back arrow, because it assumes there is a page before and not behind it.

In fact, in the code you can find:

	private _onClose(): void {
		const { onClosed, onSelected, requireSelection, selected } = this.props;
		const { modalVisible, selectedObject } = this.state;

		if (requireSelection && (selectedObject && ![selectedObject.Id]) && (selected && ![selected.Id])) return;

		if (!requireSelection) {
			onSelected({} as IModalListInDto);
		}

		this.setState({
			selectedObject: {} as IModalListInDto, // RESETTING 
			modalVisible: !modalVisible,
		});
		this.clearComponent();
		if (onClosed) {
			onClosed();
		}
	}

As you can see, the state will update with an empty object when the user closes the modal.
So, after that, the question is: is an architecture behavior to clear the selectedObject?

Otherwise, I can even make a PR to update this.

Hoping my point it's clear.

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