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

Eager mode does not work in a group/omitWhen/skipWhen #1132

Closed
TG-Modality opened this issue Jan 4, 2024 · 5 comments · Fixed by #1134
Closed

Eager mode does not work in a group/omitWhen/skipWhen #1132

TG-Modality opened this issue Jan 4, 2024 · 5 comments · Fixed by #1134
Assignees

Comments

@TG-Modality
Copy link

I was trying the eager mode when I noticed that the eager mode was not working in omitWhen.

The scenario I have is a field that has multiple tests that should be tested based on a condition:

omitWhen(exists, () => {
    test('name', 'Error', () => {
        enforce(data.code).isNotEmpty();
    });

    test('name', 'Error', () => {
        enforce(data.code).lengthEquals(2);
    });

    test('name', 'Error', async () =>
        await callToBackend(data.name)
    );
});

The second and the last tests always triggers, even when the first test is failing.

When tests are outside the omitWhen, the call to backend only triggers when the first 2 tests are successful.

@ealush ealush self-assigned this Jan 4, 2024
@ealush
Copy link
Owner

ealush commented Jan 4, 2024

@TG-Modality Thank you for reporting this. I tested your scenario and can confirm that this indeed does not work as expected.

I will work on a fix during the weekend.

@TG-Modality
Copy link
Author

@ealush Thank you for your quick response.

@ealush
Copy link
Owner

ealush commented Jan 16, 2024

Hey @TG-Modality. Sorry for taking the time. It took me a while to debug the issue. It was deep inside the core, regarding how nested scopes are being created.

Now that I have the full grasp of the problem, I'll run several tests and release an update within a few days.

@ealush
Copy link
Owner

ealush commented Jan 16, 2024

@TG-Modality should be fixed in 5.2.7. Please let me know if everything works as expected

@TG-Modality
Copy link
Author

@ealush Thank you very much. The eager mode is working in omitWhen and skipWhen.

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

Successfully merging a pull request may close this issue.

2 participants