neos-ui icon indicating copy to clipboard operation
neos-ui copied to clipboard

BUG: Navigating the Document Tree makes filtered nodes disappear

Open bwaidelich opened this issue 6 years ago • 17 comments

Description

When a node type filter is active in the navigateComponent, when navigating the node tree previously filtered nodes disappear..

This is not easy to explain, here's a video of the bug in action:

broken_node_filter

I don't understand what is happening exactly, but I can confirm that this works in the "old UI".

Using Redux DevTools to debug this I can see a lot of removed nodes in the state of the ADD event but I'm not sure if that helps ;)

image

Background

When there are a lot of (Document) Nodes on one level, this can significantly slow down the NodeTree. For this reason it can make sense to hide certain node types using the Node tree base node type.

bwaidelich avatar Mar 06 '18 12:03 bwaidelich

Not reproducable in Neos 3.3 with UI 2.x and Neos 4.2 with UI 3.x

sbruggmann avatar Mar 21 '19 12:03 sbruggmann

@bwaidelich do you still get this error?

Sebobo avatar Mar 21 '19 14:03 Sebobo

Yes, unfortunately the issue still exists for me – but not when filtering for node types, but for custom presets.

Steps to reproduce

Add some preset via Settings.yaml:

Neos:
  Neos:
    userInterface:
      navigateComponent:
        nodeTree:
          presets:
            'default':
              baseNodeType: 'Neos.Neos:Document,!Neos.Demo:Chapter'
            'legalPages':
              ui:
                label: 'Test Preset'
              baseNodeType: 'Neos.Demo:Chapter'

...follow the "steps to reproduce" from above

bwaidelich avatar Apr 01 '19 17:04 bwaidelich

We start using the custom presets for a current project and now I am affected of this issue.

I could sponsor a bugfix if anyone could do this in the next 2 weeks.

DrillSergeant avatar Sep 10 '20 10:09 DrillSergeant

As already mentioned in the PR the general issue seems to be resolved but we have some glitches left. So when you move a node inside another node the tree does not show that until you refresh the tree.

Or when you create a new node and the filter is enabled, the new node is also not part of the tree until you refresh the tree. I would say we open a new PR for that. But it works much better than before. Thanks to @dimaip and @DrillSergeant ❤️

Do you want to continue @dimaip or should I start checking that out?

markusguenther avatar Sep 25 '20 20:09 markusguenther

@markusguenther I can try to fix it on Wednesday probably, but please take over if you feel like you got the time and know how to fix it.

Basically the problem is quite clear: we render all metadata in backend using the default preset. I currently don't know how to fix it. Maybe we need to pass the currently active preset to all backend requests. Maybe there's an easier fix to just mask the issue (like I did in the other bugfix).

dimaip avatar Sep 27 '20 11:09 dimaip

Thanks for the work so far and for caring to fix the last known issue.

DrillSergeant avatar Sep 28 '20 07:09 DrillSergeant

Yes, thanks for taking care! Could you elaborate on

Basically the problem is quite clear: we render all metadata in backend using the default preset

Which kind of metadata is that in this case and why is it dependent on the current preset?

bwaidelich avatar Sep 28 '20 08:09 bwaidelich

Information about nodes, in particular node children.

dimaip avatar Sep 28 '20 08:09 dimaip

After a first test in the NodeInfoHelper.php the actions work fine with the legalPages baseNodeType. So passing this information thru the class would be solver :)

So guess will check what we need to change here. And if this will be still a bugfix ;)

markusguenther avatar Sep 28 '20 08:09 markusguenther

@dimaip Yesterday I did not find the right angle to tackle that. The quick test in the NodeInfoHelper solved the issue, but passing thru the information is not that easy I guess. As the most endpoints just use the flow query and the controller context.

So maybe adjusting the resulting flow queries are the solution. But did not finish my investigation there yesterday. But in the end the baseNodeType is the root of all eval and we need to adjust that somehow.

Hope to find time soonish... if not maybe you have more luck on Wednesday.

markusguenther avatar Sep 29 '20 10:09 markusguenther

Would be good to have this done before you do a new UI-release. In our current project the editors (more than 20 of them) will start editing content by the end of next week. It would solve a lot of problem for us if they could use the filter-presets. I can help testing. If sponsoring is needed, please contact me.

DrillSergeant avatar Oct 07 '20 06:10 DrillSergeant

I'm giving it a try now, will keep you posted

dimaip avatar Oct 07 '20 16:10 dimaip

Got it working, will push tomorrow with fresh brain

dimaip avatar Oct 07 '20 18:10 dimaip

Unfortunately the bug still exists: When moving pages in a filtered view, the tree is empty after the drag n drop interaction

bwaidelich avatar Feb 23 '21 09:02 bwaidelich

This issue still seems to exist when using folders inside a filter. Using Neos Demo (8.3) with the following settings:

Neos:
  Neos:
    userInterface:
      navigateComponent:
        nodeTree:
          loadingDepth: 2
          presets:
            default:
              baseNodeType: 'Neos.Neos:Document,!Neos.Demo:Document.LandingPage'
            global:
              ui:
                label: 'Testing'
                icon: 'fas fa-globe'
              baseNodeType: 'Neos.Demo:Document.LandingPage'

The folders show up, but the items inside the folders are not loading correctly. I made a gif of the behavior:

ezgif-2-dbd21c7915

Also, when first loading the dropdown shows up as open, but I have to click twice to show the subitems.

pKallert avatar Feb 21 '24 08:02 pKallert

Hi @pKallert,

I'm trying to write up some E2E tests for this, and I cannot reproduce the issue you've described.

But, given your configuration with:

baseNodeType: 'Neos.Demo:Document.LandingPage'

Is the tree even allowed to display the descendants of Features?

I'd interpret the baseNodeType as "show me anything that inherits from this node type". With baseNodeType being set to Neos.Demo:Document.LandingPage, that would exclude all regular pages, or am I mistaken?

grebaldi avatar Jul 02 '24 16:07 grebaldi

Hi @grebaldi

This was my first time using the filter function, so I am not sure if my expectations werde correct.

I had hoped that the descendants would show up when using the filter since it fits the usecase perfectly. And I was very happy when they did 😄

The plan was to reduce the amount of items in the main tree by moving parts of it into the filter function (everything below folder x moved to filter x). While there are also packages for this, the hope was that it could work with only core logic.

I would argue that if the descendants are shown, they should also work as expected.

As it does only half work right now, I would see two ways this could be resolved:

  • not show descendants at all if they do not fit the baseNodeType
  • show descendants and fix the loading problem

Of course I would prefer the second one, but it is confusing when the descendants show up on first load and then stop loading when the filter is unset and then reset.

pKallert avatar Jul 03 '24 07:07 pKallert

Only nodes of the given baseNodeType should be visible and their parents (which can have another type). I'm also setting this up for a customer right now where they need to work only on certain types at a time.

Sebobo avatar Jul 03 '24 07:07 Sebobo

@pKallert

As it does only half work right now, I would see two ways this could be resolved:

  • not show descendants at all if they do not fit the baseNodeType
  • show descendants and fix the loading problem

@Sebobo

Only nodes of the given baseNodeType should be visible and their parents (which can have another type).

Well... I believe @Sebobo's definition fits the original intent of the node tree preset configuration. To achieve a bugfix, we should aim to restore the first behavior as described by @pKallert (so: not show descendants at all if they do not fit the baseNodeType).

To allow for the second behavior described by @pKallert, we would require additional configuration to describe the desired semantics.

Maybe on a per-NodeType basis:

baseNodeType: 'Neos.Demo:Document.LandingPage'
perNodeType:
  'Neos.Demo:Document.LandingPage':
     baseNodeType: 'Neos.Neos:Document' # show any document beneath landing pages

Or on a per-level basis:

baseNodeType: 'Neos.Demo:Document.LandingPage'
perLevel:
  2:
     baseNodeType: 'Neos.Neos:Document' # starting at level 2, show any document 

Or even more flexible:

baseNodeType: 'Neos.Demo:Document.LandingPage'
rules:
   - condition: ${q(ancestors).filter('[instanceof Neos.Demo:Document.LandingPage]').get(0) != null && level > 2}
     baseNodeType: 'Neos.Neos:Document'

Any of these should be doable as a feature addition for 8.4.

Wdyt?

grebaldi avatar Jul 03 '24 15:07 grebaldi

@grebaldi sorry for the late answer 🥲

Doing a bugfix & new feature sounds good!

I think option 1 would be best, per-level is too restricting when using multiple baseNodeTypes and I am kind of afraid of what issues user could run into when using option 3.

I am not sure about the perNodeType naming, perhaps something like DescendantsPerNodeType?

pKallert avatar Jul 11 '24 11:07 pKallert

@pKallert:

Doing a bugfix & new feature sounds good!

Great :) I believe that the remaining bug behavior is covered by the fix in https://github.com/neos/neos-ui/pull/3822 (Correct me, if I'm wrong). So, we could add this issue to the list and let it be closed, once #3822 is merged.

For the feature part, I think it'd be best to start a fresh issue (with reference to this one) and specify the desired behavior there.

Since you're close to a specific use-case, would you like to write the spec, @pKallert?

grebaldi avatar Jul 12 '24 10:07 grebaldi