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

Add fallback to alignChildren sort to ensure correct order #341

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

Eldemarkki
Copy link

Fixes #340

@AykutSarac
Copy link
Owner

How does that solve the problem?

@Eldemarkki
Copy link
Author

Eldemarkki commented Jul 15, 2023

To be honest I don't really know. I noticed that the .sort method produced different results on Chrome and Firefox, indicating that the comparison function was not stable. Unstable sorting can be fixed by adding more logic to the comparison function and that's what I did.

Imagine a case there aChildType is array and bChildType is string. In those cases the old code returns 0, meaning that these elements "are the same", which is obviously not true, and we need to put the bChildType before aChildType (string before array). This new code does that.

I tested with many different inputs and they all worked, so this shouldn't break anything.

@Eldemarkki
Copy link
Author

Looks like this has been fixed, I assume in this change, so I'll close this PR.

@Eldemarkki Eldemarkki closed this Jul 16, 2023
@AykutSarac
Copy link
Owner

Looks like this has been fixed, I assume in this change, so I'll close this PR.

No, this commit improves type support only. We can keep this open.

@AykutSarac AykutSarac reopened this Jul 16, 2023
@Eldemarkki
Copy link
Author

@AykutSarac That other change has some logic changes too:

image
and
image

@Eldemarkki
Copy link
Author

Nevermind my other comment, it's still a bit broken so this PR is still needed. I'll check those merge conflicts tomorrow.

@Eldemarkki
Copy link
Author

@AykutSarac any updates? I've fixed the merge conflicts.

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.

[BUG]: Error rendering view when there is attribute after a array attribute
3 participants