Conversation
|
In some (minor) regards this change itself is not finished -> it definitely needs the followup #4012 but id prefer to merge these as separate parts |
56c6639 to
25607d6
Compare
Sebobo
left a comment
There was a problem hiding this comment.
Looks good, but we have to be careful with any changes to the extensibility package
|
Regarding that we no longer expose At first i thought we could provide a b/c layer to still support that but that might be impossible due to the global state initialisation. I think the important part is that few people used If we consider this a bad deal still and want to preserve full yarn semver promise i will find a way to make EDIT @Sebobo found a way to support the "SynchronousRegistry" still 744659a |
25607d6 to
7782c18
Compare
mhsdesign
left a comment
There was a problem hiding this comment.
I applied some git magic to backport some of the fixups from the other pr to here ;) Now this pr is independent ;)
And as you agree ill probably merge it soon before the sprint^^
7782c18 to
8958f0c
Compare
Originally the Neos Ui was build seemingly without real global state. There is a high order component function - invoked via a decorator @neos() which allowed to inject the registry. For functional components currently one would need to use the same high-order-pattern which is a little quirky with functions compared to say the new concept of hooks. The use of hooks as approach was shown in `@neos-project/neos-ui-link-editor-neos-bridge` we would continue to use the NeosContext and fetch the global registry or configuration from there via hooks like - useNeos() - useGlobalRegistry() - ...useConfiguration() but as this information is truly global and never leads to a re-rendering e.g. is static. We dont have to make that look like a hook but just use javascript state instead. (Like we do for the new translate() function)
… encapsulate global registry
… `@neos-project/neos-ui-registry` package
and alias and expose it via extensibility api - plugins using `import {SynchronousRegistry} from '@neos-project/neos-ui-extensibility'` must update this to use `import {SynchronousRegistry} from '@neos-project/neos-ui-registry'`
…ule overloading for extending it to know "i18n" etc
... and also instantiate validators registry here
…repository` package and register type in global registry
…w null as called with ``` const referenceGrandParentNodeType = referenceParentNode ? referenceParentNode.nodeType : null; ```
Hi style ci do you see this: """"""""""""""""""""""""""""""""""""""""""""""""""""" hope youre "happy"
…pi for plugins but preserver compatibility with `SynchronousRegistry` legacy import
8958f0c to
11b4b49
Compare
…rating types declaration otherwise typescript attempts to parse the whole neos ui repo and that fails
…n "neos-ui-extensibility" this is because the SynchronousRegistry is no longer shipped as plain code using the "positional-array-sorter" but exposed via the consumer api
11b4b49 to
ab14d04
Compare
we need to use "noResolve" otherwise typescript runs into: Cannot find module './style.module.css' or its corresponding type declarations. Fixup for #4011
TASK: Introduce api to use global state for configuration and global registry
Originally the Neos Ui was build seemingly without real global state. There is a high order component function - invoked via a decorator
@neos()which allowed to inject the registry which was distributed via react context.For functional components currently one would need to use the same high-order-pattern which is a little quirky with functions compared to say the new concept of hooks.
The use of hooks as approach was shown in
@sitegeist-archeaopteryx/neos-bridgewe would continue to use theNeosContextand fetch the global registry or configuration from there via hooks likeuseNeos()useGlobalRegistry()useI18n()useConfiguration()but as this information is truly global and never leads to a re-rendering e.g. is static. We dont have to make that look like a hook but just use javascript state instead. (Like we do for the new
translate()function)This change introduces a new package "@neos-project/neos-ui-registry" to host the global registry as singleton
Plugins
Further as part of this refactoring to move correlated code better together - the
SynchronousRegistryandSynchronousMetaRegistryare moved to the new@neos-project/neos-ui-registrypackage.This has an implication as those are exposed via extensibility api - plugins using
import {SynchronousRegistry} from '@neos-project/neos-ui-extensibility'must update this to useimport {SynchronousRegistry} from '@neos-project/neos-ui-registry'. This is a soft breaking change as we do not require anyone to update their@neos-project/neos-ui-extensibilitypackage. Previously build plugins continue to work. BUT to also allow plugins build this new way a patch must be made to 9.0 which provides@neos-project/neos-ui-registryalready for plugins.-> or we decide to target 9.0 instead.
Typings 🥳
Also we now have improved typescript support for the
globalRegistry- at least with a few registries:What I did
How I did it
How to verify it