-
Notifications
You must be signed in to change notification settings - Fork 560
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
Bug: Page.Level not correctly hydrated #2381
Comments
The Level and HasChildren properties on the Page entity are not stored in the database - they are run-time properties. They are populated when the GetPagesAsync() method is called by the client (this method calls a private GetPagesHierarchy() method which recursively sets Level and HasChildren). GetPagesAsync() is called by the SiteRouter which loads the PageState.Pages collection into memory so that it is available in every UI component. So your theme should reference PageState.Pages and the Level and HasChildren properties will always be populated. These are run-time properties by design as the pages collection can vary based the permissions of the currently logged in user. |
I'm actually using From my understanding of the code, it's populated from the
and the
|
I believe this may have been caused by the performance refactoring for the next release. I will have to take a closer look. |
I confirmed this was caused by the performance refactoring for the next release. #2385 resolves the issue - it also offloads the recursive hierarchy ordering logic from the client to the server so that it can benefit from the higher CPU and caching |
Awesome, the solution looks great, just what's needed. thx! |
Background
We're working on creating a really advanced theme as a template for well designed solutions.
As such we need the ability to create various kinds of navigation, typically based on configuration, so that a designer doesn't have to always code every detail how it works.
The goal is to have something similar as DDRMenu in DNN.
One of the needs of these menus is to be able to specify things such as
Problem
We ran into the problem that the Page.Level is always 0. After some research into the code it appears that the Page.Level is only ever set once in Oqtane, but normally not set. The only case where we could find it being written to is
private static List<Page> GetPagesHierarchy(List<Page> pages)
inPageService
public async Task<List<Page>> GetPagesAsync(int siteId)
in the samePageService
So
PageState.Pages
always report an incorrect Level of zero. It appears this is always derived fromSite.Pages
SiteController.cs
Likely Fix
The level should always be calculated up front, probably in the SiteController. That would also make any calculations in the PageService obsolete.
The text was updated successfully, but these errors were encountered: