-
-
Notifications
You must be signed in to change notification settings - Fork 9.8k
Angular: force re-render if template change #13638
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
Conversation
| export const moduleMetadata = ( | ||
| metadata: Partial<NgModuleMetadata> | ||
| ): DecoratorFunction<StoryFnAngularReturnType> => (storyFn) => { |
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.
This is a breaking change too 🙈 however I'm not sure a lot of users should be impacted by it, maybe addons authors?
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.
the type before :
(storyFn: StoryFn<StoryFnAngularReturnType>) => any
the type after uses :
export declare type DecoratorFunction<StoryFnReturnType = unknown> = (fn: StoryFn<StoryFnReturnType>, c: StoryContext) => ReturnType<StoryFn<StoryFnReturnType>>;
type ReturnType<T extends (...args: any) => any> = T extends (...args: any) => infer R ? R : any;
The change is on any (it seems to me 🤔 ) =>
(storyFn: StoryFn<StoryFnAngularReturnType>) => StoryFnAngularReturnType
This will specify the return type but not change behavior
Indeed if the function is badly used it is likely to require a fix of type 🤷♂️
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.
My concern was more about the 2nd argument introduced by DecoratorFunction: c: StoryContext. The previous type implied only 1 arg: storyFn.
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.
:aa:
I forgot it. Indeed type imposes it. but it has always been present
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.
Yeah... I'm really not sure it is a big deal as it's mainly internal plumbing
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.
Indeed type imposes it. but it has always been present
So we can consider it as a fix more than a refactoring.
|
@gaetanmaisse thank you for thinking about these aspects 🙏
I await your feedback and will make changes accordingly |
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.
Looks good to me aside from the types issue. We can also make breaking changes to the types if needed, but it's probably more trouble than it's worth.
9023d09 to
0be6bec
Compare
| export const moduleMetadata = ( | ||
| metadata: Partial<NgModuleMetadata> | ||
| ): DecoratorFunction<StoryFnAngularReturnType> => (storyFn) => { |
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.
Indeed type imposes it. but it has always been present
So we can consider it as a fix more than a refactoring.
…gularReturnType No longer appears to be used, based on a search on variable name
…shots like app/angular/client/preview/types.ts
Preview/angular/* is now legacy. The decorators defined here are not. So they are moved to preview root
If the template is changed by a decorator, for example, it is necessary to re-render the story
0be6bec to
920ad34
Compare
Issue: https://discord.com/channels/486522875931656193/490770949910691862/799325399635984465
maybe others 🤷♂️
What I did
How to test
YesNoNoIf your answer is yes to any of these, please make sure to include it in your PR.