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

Fix: Error when inserting an empty list in manyOf #43

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

tad-lispy
Copy link

The bug is described in #42, but I would not consider this PR a fix as it does not address the error message helpfullness. Seems like more work need to be done there.

The problem this PR addresses is in the ExpectManyOf case of Mark.Internal.Description.matchExpected. There are two variables there:

  • oneOptions
  • twoOptions

In case of updates oneOptions will be a list of all valid options. The twoOptions will be a list of blocks that are actually inserted.

We want to check if all inserted blocks match any of the valid options. But it was the other way around - the test was "Are all valid options inserted?". Coincidentally when there is only one valid option and one block is inserted, the result is the same. That's probably why the problem remained undetected for relatively long time. I ran into it becasue my list was nested in a record (as described in the linked issue) and was initially empty.

That's also why I consider the error message unhelpful. It suggested there is something wrong with the record, but the "problem" was nested in one of the fields. I have some thoughts about improving this, but one thing at a time :D

The bug is described in
mdgriffith#42, but I would not
consider it a fix as it does not address the error message helpfullness.

The problem is that in `ExpectManyOf` case of
`Mark.Internal.Description.matchExpected` . There are two variables
there:

    - `oneOptions` `twoOptions`

In case of updates `oneOptions` will be a list of all valid options. The
`twoOptions` will be blocks that are actually inserted.

We want to check if all inserted blocks match any of the valid options.
But it was the other way around - the test was "all valid options are
inserted". Coincidentally when there is only one valid option and at
least one block is inserted, the result is the same. That's probably why
the problem remained undetected for relatively long time. I ran into it
becasue my list was nested in a record (as described in the linked
issue) and was initially empty.
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 this pull request may close these issues.

1 participant