Skip to content

[Fix] Child element goes missing when parent element is deleted. #5028

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

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

Conversation

karandatwani92
Copy link
Contributor

WHY

Solved #4982 #4908

HOW

We were not rendering all items.

@karandatwani92
Copy link
Contributor Author

karandatwani92 commented Apr 11, 2023

Hey @pxpm!

This is the best solution as per my understanding. I tested in multiple ways, worked every way!
You too have a check! 🤞

@karandatwani92 karandatwani92 changed the title loop-all-entries [Fix] Reorder stops working when depth > 2 and middle element is deleted Apr 11, 2023
@karandatwani92 karandatwani92 changed the title [Fix] Reorder stops working when depth > 2 and middle element is deleted [Fix] Child element goes missing when parent element is deleted. Apr 11, 2023
@pxpm pxpm self-requested a review April 12, 2023 08:16
Copy link
Contributor

@pxpm pxpm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @karandatwani92

I think the problem goes a little deeper than that.

If I set some entries with parent_id = 0 (meaning they are root elements) and use the plugin protectRoot: true option https://github.com/ilikenwf/nestedSortable, those "parents" cannot be nested into any other elements. (that's what is expected).

But after I save the first time the order, they are saved with parent_id = null and can be nested after the first save. (that's not good).

I mention this because I think this may be the solution to the problem you are trying to fix here too.

Let me know if I am missing something, sometimes happens.

Cheers

@pxpm pxpm assigned karandatwani92 and unassigned pxpm Apr 12, 2023
@karandatwani92
Copy link
Contributor Author

Hey @pxpm . I need you help.

I'm getting what you mean. I tried it with protectRoot: true property and yes it turns parent_id 0 to null.

but i don't get what i need to do. The protectRoot: true property disables the flexibility of reordering. Each sub node have it's parent, so only the last child only becomes reorderable. I guess that's why we are not using it our reorder.

@pxpm pxpm assigned promatik and unassigned karandatwani92 Oct 11, 2023
@pxpm pxpm added Priority: COULD Priority: SHOULD Minor Bug A bug that happens only in a very niche or specific use case. labels Oct 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Minor Bug A bug that happens only in a very niche or specific use case. Priority: COULD Priority: SHOULD
Development

Successfully merging this pull request may close these issues.

3 participants