diff --git a/docs/guide/migrations/0-6.md b/docs/guide/migrations/0-6.md index 2b8cec1e..05991dad 100644 --- a/docs/guide/migrations/0-6.md +++ b/docs/guide/migrations/0-6.md @@ -130,6 +130,13 @@ Modifiers have renamed their `revert` property to `invert` to match the terms us Lazy proxies now call the options function with the base object as the `this` argument and the first parameter. Features with `options` functions are expected to pass the base object as the `this` argument and first parameter as well. The `OptionsFunc` type has already been updated for this, so TS will complain if you skip this migration step. +You'll also want to add support for decorators. You'll want to add the new parameter `...decorators: GenericDecorator[]`, and then call their functions: + +- Gather their persistent data _outside_ the layer proxy, like `const decoratedData = decorators.reduce((current, next) => Object.assign(current, next.getPersistentData?.()), {})` +- At the beginning of the layer proxy, call each `preConstruct` that exists, e.g. `decorators.forEach(d => d.preConstruct?.(feature))` +- At the end of the layer proxy, call each `postConstruct` that exists, e.g. `decorators.forEach(d => d.postConstruct?.(feature))` +- Gather props by generating them like `const decoratedProps = decorators.reduce((current, next) => Object.assign(current, next.getGatheredProps?.(achievement)), {})` and destructure it in the `GatherProps` function + ## Fixing visibility changes Visibility properties now work with booleans, which has several implications.