Skip to content
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

Vue3:fix reactive decorators #21954

Merged
merged 153 commits into from
Apr 19, 2023
Merged

Vue3:fix reactive decorators #21954

merged 153 commits into from
Apr 19, 2023

Conversation

chakAs3
Copy link
Contributor

@chakAs3 chakAs3 commented Apr 5, 2023

Closes #21235 #21221 #21812

What I did

fixing losing reactivity when using decorators ( global decorator ex: vuetify , function story decorator , template story decorator )
now vue stories support 👍 :

  • Reactive args with default render function or custom render function, render function can be return ( Functional Component, Concrete Component , Options Component )
  • Reactive args with story decorators, or global decorators, decorators are functions that return Functional Component, Concrete Component with template, or Options Component .
  • Reactive named slots and scoped slots with default render or custom render function

PR has a good tests coverage for these 3 features, but you can add some others if you feel they can be relevant

How to test

Checklist

  • Make sure your changes are tested (stories and/or unit, integration, or end-to-end tests)
  • Make sure to add/update documentation regarding your changes
  • If you are deprecating/removing a feature, make sure to update
    MIGRATION.MD

Maintainers

  • If this PR should be tested against many or all sandboxes,
    make sure to add the ci:merged or ci:daily GH label to it.
  • Make sure this PR contains one of the labels below.

["cleanup", "BREAKING CHANGE", "feature request", "bug", "documentation", "maintenance", "dependencies", "other"]

chakAs3 and others added 3 commits April 17, 2023 14:48
…into chaks/vue3-reactive-decorators

# Conflicts:
#	code/renderers/vue3/template/stories/ReactiveDecorators.stories.ts
@kasperpeulen kasperpeulen removed the patch:yes Bugfix & documentation PR that need to be picked to main branch label Apr 17, 2023
@kasperpeulen kasperpeulen self-requested a review April 18, 2023 16:01
Copy link
Contributor

@kasperpeulen kasperpeulen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you can get the tests in proper state, feel free to merge it.

code/renderers/vue3/src/decorateStory.ts Outdated Show resolved Hide resolved
// to test that Simple html Decorators in CSF2 format are applied correctly in reactive mode
export const ReactiveCSF2Wrapper = (args, { argTypes }) => ({
components: { ReactiveArgs },
props: Object.keys(argTypes),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a general question, do you think we should recommend this style with props?

Or this style with data to make the args available:

data: () => ({ args })

code/renderers/vue3/src/render.ts Show resolved Hide resolved
Comment on lines 53 to 56
story = decorated({
...context,
...sanitizeStoryContextUpdate(update),
});
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't we make sure args stay reactive when they get overridden here by an decorator update?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we have tests for updating args from a decorator update?

code/renderers/vue3/src/decorateStory.ts Outdated Show resolved Hide resolved
@chakAs3
Copy link
Contributor Author

chakAs3 commented Apr 18, 2023

If you can get the tests in proper state, feel free to merge it.

i have gone all the tests to get them properly, + ReactiveSlots.stories as well

@chakAs3 chakAs3 merged commit 29cdc26 into next Apr 19, 2023
@chakAs3 chakAs3 deleted the chaks/vue3-reactive-decorators branch April 19, 2023 00:51
knime-github pushed a commit to knime/knime-ui-table that referenced this pull request May 16, 2023
With the more recent version, most of the settings are no longer
reactive which seems to be a bug on storybook side. It could have
something to do with storybookjs/storybook#21954
but is not resolved by this version either

UIEXT-609 (Make knime-ui-table more developable across multiple teams)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

Addon-controls/Vue3: Control update while using decorators causes component to unmount/remount
6 participants