-
-
Notifications
You must be signed in to change notification settings - Fork 135
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
!!!FEATURE: Reform foundation and boot process of the UI #3682
Conversation
330a48d
to
5922ea3
Compare
5922ea3
to
b1dbfd4
Compare
Thank you so much!!! This really cleans up many things that are needlessly messy and hard to understand. I added already a dec comments to your text and will look over the code later ;)
I only know that I have used the init see: About:
and
I have never heard of those things so I assume they can go;)
Today I actually prefer the use of the defer attribute … feels cleaner to have them in the head … but it’s really not important Note to myself:
Also i think we should incorporate #2920 into here. Thanks again!!!! :D |
Hi @mhsdesign, thanks a lot for your very valuable feedback 👍
I'm always afraid of introducing race conditions when it comes to this stuff 😅. Well, MDN states:
So, I guess this means we have a guarantee that the script can see the whole document? I mean I'm with you, that we should use I also have some ideas bouncing around in my head with regards to the code issues you've pointed out. I similarly feel that the fusion foundation as of right now is less than ideal. I see two possible way out of here: A) Build dedicated Fusion So, basically, this would mean to back the following prototypes with classes:
This would move all the resource-collecting logic out of the controller and out of the fusion code. It'd also eliminate the need for B) Replace Fusion with a dedicated application view class Because: what's the point of using Fusion to initialize the UI anyway? A dedicated view could take care of hiding the resource-collecting logic from the controller. The wdyt? |
Oh, and regarding #3098: I don't think that this issue would be fixed as of right now. But I'm going to try to move around some bits of the boot process (should be possible), so plugins have an easier time reading this stuff. |
I actually dont know that much about
And yeah i thought so too... well lets just use b? :D especially things like
make me rethink if fusion is the right choice 😅 Aaand we might finally remove this weirdly namespaced |
I looked into the spec, but it is just as imprecise about the exact timing as MDN is:
(see: https://html.spec.whatwg.org/multipage/scripting.html#attr-script-defer) Then I found this article that is very confident in saying:
(see: https://calendar.perfplanet.com/2016/prefer-defer-over-async/#attributes) Sadly no sources to back that up... I guess it wouldn't make sense for any
Actually, you'd have to do quite some acrobatics to hook into the backend fusion view. It cannot be extended via regular ol' I think the reasoning for using fusion back then was that it provided a unified high-level API for both MVC/Routing and ContentRepository, which are both major concerns for initial hydration of the UI. But this was always supposed to be a strictly hidden implementation detail.
neos-ui/Configuration/Settings.yaml Lines 94 to 96 in 2204bb1
☝️ Well... Actually those settings are not supposed to be API. However, this is certainly not the best way to hide stuff 😅 I'd like to get rid of this mechanism as well, but that exceeds the scope of this PR.
I'll add that to the list as well :) |
c5216a0
to
9d58de7
Compare
Thanks for the housekeeping and implementing the
yes i fully agree and also talked to @Sebobo about this. There is absolutely no need to have it in fusion and php would be a better fit. But to keep this pr rather simpler, i would say that we could keep the fusion code in one messy file for now and refactor it to php with another followup pr? I especially dont want to merge the But if you think its doable in scope of this pr i wouldnt mind moving to php quicker. |
Already on it :D |
d288e5f
to
dc750be
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
WOW ❤️ 🎉 thank you so much for so cleanly moving the neos ui integration to php.
The code looks way more obvious and is easier to follow! Thanks a lot!
Fyi this will be a bit nasty to rebase to #3689 but i think doable, so i would propose to merge that first? |
This way, the UI does not need to listen to `DOMContentLoaded` in order to discover the `#appContainer` element. This allows a lot of the UI boot process to become synchronous.
Functionally, it stays the same, but the boot process is no longer a Redux Saga. It is instead an asynchronous function that runs when the `DOMContentLoaded` event was fired. Also, the various boot-related sub-processes (initializing plugins, loading translations, etc...) have been wrapped in dedicated functions.
As it is no longer needed.
As it is no longer needed.
...rather than inlineing it. `JSON.parse` is somewhat more efficient, because for JSON only a subset of ECMAScript has to be parsed.
The error message has been adjusted to the look of the global ErrorBoundary, re-using its stylesheet.
...as it is no longer needed.
The fusion path is now dynamically determined by controller / action This enables additional actions with separate templates for that controller.
…apping the UI The `ApplicationView` builds the foundational HTML document (via string concatenation) for bootstrapping the Neos UI. Formerly, Fusion was used to retrieve and render the initial data for the UI. This task has been delegated to a set of dedicated classes, namely: - `ConfigurationProvider` - retrieves the `nodeTree` and `structureTree` segments from `Neos.Neos.userInterface.navigateComponent` settings, `allowedTargetWorkspaces` from the ContentRepository's `WorkspaceService` as well as the `nodeTypeSchema` and `translations` endpoints. - `RoutesProviderInterface` - retrieves all other routes/endpoints required for communication with the Neos server application - `FrontendConfigurationProvider` - reads and preprocesses the `Neos.Neos.Ui.frontendConfiguration` settings that are mostly used by third-party plugins to share data between server and client - `NodeTypeGroupsAndRolesProviderInterface` - retrieves information about node type roles and node type groups. Roles are a dedicated UI-concept that is meant to distinguish between document, content and collection nodes. Groups refer the grouping of node types in the creation dialog. - `MenuProvider` - retrieves all data needed to render the main burger menu located in the top left corner of the UI. - `InitialStateProvider` - reads and preprocesses the `Neos.Neos.Ui.initialState` settings that are used to hydrate the UI's redux store The responsibilities of these classes is entirely derived from their former Fusion counterparts. All of them have been marked `@internal` to allow for later removal. Nonetheless, it remains possible to implement their accompanying interfaces and replace their implementations via `Objects.yaml`. This enables rare edge cases and unplanned extensibility. The splash screen, formerly a Fluid template, is now hard-coded into the `ApplicationView` class, which renders the `Neos.Neos.Ui.splashScreen` setting obsolete. It has therefore been removed.
With the new `ApplicationView` this code is no longer in use anywhere.
This action used to be fired before all asynchronous operations at the beginning of the boot process. Since there's not a single subscriber within the UI code base that listens to that action, it has now been removed.
0fc5ed9
to
e092605
Compare
This also removes handling of the legacy first level 'defer' setting in the `Neos.Neos.Ui.resources` settings. If it is set, it will be ignored.
Id say this is nearly ready to be merged. Because im a little paranoid i actually diffed the initial bootstrap html before and after and found a few differences worth noting. First it seems that the {
"label": "Neos.Neos:Modules:user.label",
"icon": "fas fa-users",
"children": [
{
"icon": "fas fa-user",
"label": "Neos.Neos:Modules:userSettings.label",
"uri": "http:\/\/localhost:8081\/neos\/user\/usersettings",
}
]
} There seems to be a And second, it seems that we boot the ui with more data: I found that everything mapped to the legacy globals but there is a new entry
Edit. I found the cause. We json_encode all the $this->variables, but it was once thought be a good feature to have the settings automagically available see neos/flow-development-collection@b944521. |
…om is initialized yet
…rything into `initialData` Previously this feature neos/flow-development-collection@b944521 would cause also the rendering of the neos ui `settings`
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I adjusted the previously mentioned parts a little and now everything is like expected.
I would prefer another or two reviews though ^^
Thanks again for the hard work!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, just left one question regarding the necessity of the Views.yaml
refs: #3119
next: #3773
This is the first in a series of PRs that will enable the creation of multiple applications based on a Neos UI core.
This PR turns the
Backend/Index.html
Fluid template into a dedicatedApplicationView
. ThisApplicationView
has the sole purpose of building the foundational HTML document (via string concatenation) for bootstrapping the Neos UI.Formerly, Fusion was used to retrieve and render the initial data for the UI. This task has been delegated to a set of dedicated classes, namely:
ConfigurationProvider
- retrieves thenodeTree
andstructureTree
segments fromNeos.Neos.userInterface.navigateComponent
settings,allowedTargetWorkspaces
from the ContentRepository'sWorkspaceService
as well as thenodeTypeSchema
andtranslations
endpoints.RoutesProviderInterface
- retrieves all other routes/endpoints required for communication with the Neos server applicationFrontendConfigurationProvider
- reads and preprocesses theNeos.Neos.Ui.frontendConfiguration
settings that are mostly used by third-party plugins to share data between server and clientNodeTypeGroupsAndRolesProviderInterface
- retrieves information about node type roles and node type groups. Roles are a dedicated UI-concept that is meant to distinguish between document, content and collection nodes. Groups refer the grouping of node types in the creation dialog.MenuProvider
- retrieves all data needed to render the main burger menu located in the top left corner of the UI.InitialStateProvider
- reads and preprocesses theNeos.Neos.Ui.initialState
settings that are used to hydrate the UI's redux storeThe responsibilities of these classes is entirely derived from their former Fusion counterparts. All of them have been marked
@internal
to allow for later removal. Nonetheless, it remains possible to implement their accompanying interfaces and replace their implementations viaObjects.yaml
. This enables rare edge cases and unplanned extensibility.The splash screen, formerly a Fluid template, is now hard-coded into the
ApplicationView
class, which renders theNeos.Neos.Ui.splashScreen
setting obsolete. It has therefore been removed.Furthermore, this PR reforms the client-side boot process of the UI. This includes the following changes:
<head/>
withdefer
JSON.parse
d instead ofwindow['_NEOS_UI_*']
edJSON.parse
is somewhat more performant, because for JSON only a subset of ECMAScript needs to be parsed. (Though, this is not all that significant given the amount of data, but still 🙂)data-first-tab
attribute has been removed from #appContainerRemaining TODOs
<head>
-scripts +defer
instead of<body>
-scripts for script inclusionTurn the remaining Fluid templates into Fusion prototypes as well (optional)Backend/ConfigurationVersion.html
Backend/Guest.html
Backend/GuestNotificationScript.html
Error/ErrorMessage.html
actions.System.boot()
dispatch?Neos.Neos.Ui.splashScreen
configurationRemove fusion objects that are no longer relevantNeos.Neos.Ui:RenderConfiguration
Deprecate EEL-Helpers that are no longer relevantNeos.Ui.Workspace
NodeTypesProviderInterface
->NodeTypeGroupsAndRolesProviderInterface
Objects.yaml
instead of explicitly configuringBackendController
propertiesdefer
attribute on<script/>
-includes throughNeos.Neos.Ui.resources
settingsNote to fellow maintainers
In order to preserve the usefulness of the commits in this PR, please do not merge any of the version branches into this branch. To update the code with the latest changes in
9.0
, please do an interactive rebase instead:This will require
afterwards.
This way, every commit will be replayed on top of
9.0
, and can be adjusted seperately.