-
-
Notifications
You must be signed in to change notification settings - Fork 9.4k
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
Vue3:fix reactive decorators #21954
Changes from 128 commits
Commits
Show all changes
153 commits
Select commit
Hold shift + click to select a range
9f1f4ef
rewrite source decorator with optimisation
chakAs3 c416f70
some experimental
chakAs3 8ef5ad5
Merge branch 'next-remote' into chaks/vue3-source-fix
chakAs3 3dc96b1
start writing propre tests for source decorator
chakAs3 207ab63
write tests for 2 main src decorator functions
chakAs3 6ab9fc1
add new tests
chakAs3 46307ba
adjusting the render with tests
chakAs3 4c14b10
add more tests for sources decorator
chakAs3 c8b7e68
testing the render
chakAs3 c8e157e
vue3 fixing prepareStory for decotators
chakAs3 2a81e98
some refactoring and cleanup
chakAs3 dab4855
after merging next branch
chakAs3 233361a
fix null slots
chakAs3 2b205f8
handle no slots , null issue
chakAs3 b874cbe
fix args Inheritance and reactivity
chakAs3 d3f061a
merging next branch
chakAs3 3d0b620
fix null value exception for mdx stories
chakAs3 da8b3b4
fix slot double quote display
chakAs3 dc32a83
fix source for mdx using originFn and context
chakAs3 14eca7c
refactory generateSource to be elegante
chakAs3 b758496
add some tests for source decorator and render
chakAs3 265fc65
merging next to local branch
chakAs3 ada469d
add some tests and fix CSF2 with decorator
chakAs3 284313a
fixing react decorator breaks the reactivity
chakAs3 a65844e
complete merging next branch
chakAs3 4a7d98b
use remount as easier way
chakAs3 f681d83
emit using channel forceRemount
chakAs3 f670ef5
cleanup code
chakAs3 a5284cd
fix args after tests + cleanup
chakAs3 fb1c507
attribute style dynamic source
chakAs3 c0ffbe0
string double quote isse
chakAs3 7183154
v-bind , style display as string
chakAs3 db908d3
style should be dynamic in source
chakAs3 6d4d3aa
cleanup after testing.
chakAs3 13699fe
refactor add utils to docs
chakAs3 70da242
merging next branch
chakAs3 311a69e
add utils
chakAs3 d38c8ac
use vue watch() instead of useEffect()
chakAs3 13af5c9
merge next branch
chakAs3 51cf252
just to rerun the ci, it did pass on server y??
chakAs3 20bee15
Merge branch 'next' into chaks/vue3-source-fix
chakAs3 6c806b6
fix slots reactivity without render function temp
chakAs3 a75e222
fix undefined attr + cleanup
chakAs3 3919b51
merge next branch
chakAs3 fc833f4
run decorators in renderToCanvas save reactivity
chakAs3 a46d316
great reasult finally
chakAs3 3e20291
merge next branch
chakAs3 069d615
add try catch in case decorator are react Fn use
chakAs3 8a3ea0a
slots properly rendered , and source generated
chakAs3 4408459
cleanup
chakAs3 4b3ee67
source generating for slots with recusivity with
chakAs3 d8c87af
refactory and cleanup
chakAs3 1aa308a
merge next branch
chakAs3 5643df2
fix the units tests
chakAs3 4634f30
remove console logs
chakAs3 12dd5fb
cleanup oode and try to solve yn pkg issue
chakAs3 f2a8cc7
cleanup and refactory
chakAs3 42efaff
Merge remote-tracking branch 'origin/next' into chaks/vue3-source-fix
chakAs3 9c8ae2c
fix prep, pass tests
chakAs3 6e10751
Merge remote-tracking branch 'origin/next' into chaks/vue3-source-fix
chakAs3 3add1df
refactory get slots
chakAs3 f274f05
fix args updates and correct unit tests
chakAs3 24aa492
fix args update
chakAs3 ad2963b
Merge branch 'next' into chaks/vue3-source-fix
chakAs3 d62fa0f
fix hooks story tests, by triggering render all tree
chakAs3 29d0d8e
Merge branch 'next' into chaks/vue3-source-fix
chakAs3 69ac813
add slots test story to vue3 renderer templates
chakAs3 1f863d2
Merge branch 'next' into chaks/vue3-source-fix
chakAs3 4dec2e0
using storyFn to update args from decorators
chakAs3 b69c897
get it done properly yeeeey
chakAs3 88e654a
refactory after testings
chakAs3 228458b
fix tests
chakAs3 85d74d2
add scoped slot tests stories
chakAs3 647820d
added arg to Reactive SLot test story
chakAs3 c09528a
add test story without render fn for Scoped slots
chakAs3 76840f5
Merge branch 'next' into chaks/vue3-source-fix
chakAs3 acd6563
Merge branch 'next' into chaksfi/vue3-source-fix
chakAs3 49a2fb5
get back eval for printing the object value
chakAs3 0411ab3
i don't know this passed the tests and now does not, some on reat:che…
chakAs3 08d1204
remove files
chakAs3 95f298d
Merge branch 'next' into chaks/vue3-source-fix
chakAs3 4aad462
Improve ScopedSlot test and TS test coverage
kasperpeulen e6d2825
Add caching middleware back
kasperpeulen 661b738
slots test story +Test reactivity with decorator and CSF2
chakAs3 564463f
cleaup logs
chakAs3 e6ade2c
add utility function
chakAs3 f4390e2
Merge branch 'chaks/vue3-source-fix' of https://github.com/storybookj…
chakAs3 bc9fe08
add Slot Story with Render to test interpolation & fixing unit test
chakAs3 423f86e
Merge branch 'next' into chaks/vue3-source-fix
chakAs3 786b17c
fix variable declaration source
chakAs3 67b4ea6
Merge branch 'next' into chaks/vue3-source-fix
chakAs3 35a3638
fix unit tests
chakAs3 bad517f
remove logs..
chakAs3 1188c57
fix TS issue , check not passing
chakAs3 cde13df
Merge branch 'next' into chaks/vue3-soe-fix
chakAs3 fdc1749
fix ci add vite 4.2.0 to resolutions sandboxes
chakAs3 9d98535
Merge branch 'next' into chaks/vue3-source-fix
chakAs3 1dec3ea
Start with tests
kasperpeulen 1557a74
Merge branch 'next' into chaks/vue3-source-fix
dxb-story 049df9d
Merge branch 'next' into chaks/vue3-source-fix
dxb-story 65a1964
remove the watch on context.globals, we call anyway storyFn on render…
dxb-story 960952c
merge next chaks/vue3-source-fix
dxb-story eab5643
merge next intot chaks/vue3-source-fix
chakAs3 ec774f8
merge next branch
chakAs3 ea0157d
revert source decorator to next branch
chakAs3 5f25b9a
passe context.args to keep the args reactive
chakAs3 c638d2b
remove utils keep next branch code
chakAs3 fdd85d9
merge next
chakAs3 aef38c1
Merge branch 'next' into chaks/vue3-reactive-decorators
chakAs3 4c5bc51
remove comments from render.ts
chakAs3 251c006
Merge branch 'next' into kasper/vue-tests
chakAs3 d974fcf
Merge branch 'chaks/vue3-reactive-decorators' into kasper/vue-tests-w…
chakAs3 2847022
rework test stories visually & functionally to match vue reactivty/r…
chakAs3 df03af5
return the functional component instead normalize it with Render fun…
chakAs3 ec787ca
Merge branch 'next' into chaks/vue3-reactive-decorators
chakAs3 0e7b798
Merge branch 'chaks/vue3-reactive-decorators' into kasper/vue-tests-w…
chakAs3 8862c83
Merge branch 'next' into chaks/vue3-reactive-decorators
chakAs3 1c2a73b
remove unecessary files & rename the stories files
chakAs3 cd7cba6
passing context args to inner story
chakAs3 2c4849d
use the usual test api ( getByRole ..)
chakAs3 e0f310a
remove console.log
chakAs3 0dc3299
cleanup code
chakAs3 3f62d1e
revise the tests + support component props declaration
chakAs3 dc888ab
add emit reset & change args to simulate the changes
chakAs3 4a6ace0
cleanup and add more comments to make it clear
chakAs3 ab19689
Merge branch 'next' into chaks/vue3-reactive-decorators
chakAs3 7208a63
fix type:check
chakAs3 ab6738f
cleaup comments and remove no used calls
chakAs3 a0a47f8
fixing ts check
chakAs3 6df145a
removing some experiments
chakAs3 95ff25b
fixing reactive with using functional component as render
chakAs3 da27a5b
add test for reactive functional component render
chakAs3 186b10c
refactory and cleanup story preparation
chakAs3 19be3b2
Merge remote-tracking branch 'origin/next' into chaks/vue3-reactive-d…
chakAs3 6624221
fix linter cercleci
chakAs3 036e28a
Update tests
kasperpeulen ab083db
Merge remote-tracking branch 'origin/chaks/vue3-reactive-decorators' …
kasperpeulen de26d1e
Apply args to functional decorators.
kasperpeulen 01aee9c
Rename
kasperpeulen 9e974b4
Add reactive slot test
kasperpeulen 0fc05ca
Apply args to functional decorators.
chakAs3 5edbd29
Merge branch 'chaks/vue3-reactive-decorators' of https://github.com/s…
chakAs3 620f87b
cleanup test logs
chakAs3 60968cd
rectify the visual tests to have proper testing
chakAs3 9f1c700
rectify visual tests to perform proper tests
chakAs3 11926f6
Merge branch 'next' into chaks/vue3-reactive-decorators
chakAs3 b41e300
add support reactive slots with default render function
chakAs3 6c24346
complete the slots test stories
chakAs3 20ab58c
compte unit tests for reactive slots all types
chakAs3 667e494
refactory and cleanup
chakAs3 92e7a3b
fix default token error
chakAs3 aea5936
normalize unit test / visual test stories
chakAs3 d3e3522
fix arg type in slot function
chakAs3 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
import { expectTypeOf } from 'expect-type'; | ||
|
||
import { reactive } from 'vue'; | ||
import { updateArgs } from './render'; | ||
|
||
describe('Render Story', () => { | ||
test('update reactive Args updateArgs()', () => { | ||
const reactiveArgs = reactive({ argFoo: 'foo', argBar: 'bar' }); // get reference to reactiveArgs or create a new one; | ||
expectTypeOf(reactiveArgs).toMatchTypeOf<Record<string, any>>(); | ||
expectTypeOf(reactiveArgs).toEqualTypeOf<{ argFoo: string; argBar: string }>(); | ||
|
||
const newArgs = { argFoo: 'foo2', argBar: 'bar2' }; | ||
updateArgs(reactiveArgs, newArgs); | ||
expectTypeOf(reactiveArgs).toEqualTypeOf<{ argFoo: string; argBar: string }>(); | ||
expect(reactiveArgs).toEqual({ argFoo: 'foo2', argBar: 'bar2' }); | ||
}); | ||
|
||
test('update reactive Args component inherit objectArg updateArgs()', () => { | ||
const reactiveArgs = reactive({ objectArg: { argFoo: 'foo', argBar: 'bar' } }); // get reference to reactiveArgs or create a new one; | ||
expectTypeOf(reactiveArgs).toMatchTypeOf<Record<string, any>>(); | ||
expectTypeOf(reactiveArgs).toEqualTypeOf<{ objectArg: { argFoo: string; argBar: string } }>(); | ||
|
||
const newArgs = { argFoo: 'foo2', argBar: 'bar2' }; | ||
updateArgs(reactiveArgs, newArgs); | ||
expectTypeOf(reactiveArgs).toEqualTypeOf<{ objectArg: { argFoo: string; argBar: string } }>(); | ||
expect(reactiveArgs).toEqual({ | ||
argFoo: 'foo2', | ||
argBar: 'bar2', | ||
}); | ||
}); | ||
|
||
test('update reactive Args component inherit objectArg', () => { | ||
const reactiveArgs = reactive({ objectArg: { argFoo: 'foo' } }); // get reference to reactiveArgs or create a new one; | ||
expectTypeOf(reactiveArgs).toMatchTypeOf<Record<string, any>>(); | ||
expectTypeOf(reactiveArgs).toEqualTypeOf<{ objectArg: { argFoo: string } }>(); | ||
|
||
const newArgs = { argFoo: 'foo2', argBar: 'bar2' }; | ||
updateArgs(reactiveArgs, newArgs); | ||
expect(reactiveArgs).toEqual({ argFoo: 'foo2', argBar: 'bar2' }); | ||
}); | ||
|
||
test('update reactive Args component 2 object args -> updateArgs()', () => { | ||
const reactiveArgs = reactive({ | ||
objectArg: { argFoo: 'foo' }, | ||
objectArg2: { argBar: 'bar' }, | ||
}); // get reference to reactiveArgs or create a new one; | ||
expectTypeOf(reactiveArgs).toMatchTypeOf<Record<string, any>>(); | ||
expectTypeOf(reactiveArgs).toEqualTypeOf<{ | ||
objectArg: { argFoo: string }; | ||
objectArg2: { argBar: string }; | ||
}>(); | ||
|
||
const newArgs = { argFoo: 'foo2', argBar: 'bar2' }; | ||
updateArgs(reactiveArgs, newArgs); | ||
|
||
expect(reactiveArgs).toEqual({ | ||
argFoo: 'foo2', | ||
argBar: 'bar2', | ||
}); | ||
}); | ||
|
||
test('update reactive Args component object with object -> updateArgs()', () => { | ||
const reactiveArgs = reactive({ | ||
objectArg: { argFoo: 'foo' }, | ||
}); // get reference to reactiveArgs or create a new one; | ||
expectTypeOf(reactiveArgs).toMatchTypeOf<Record<string, any>>(); | ||
expectTypeOf(reactiveArgs).toEqualTypeOf<{ | ||
objectArg: { argFoo: string }; | ||
}>(); | ||
|
||
const newArgs = { objectArg: { argFoo: 'bar' } }; | ||
updateArgs(reactiveArgs, newArgs); | ||
|
||
expect(reactiveArgs).toEqual({ objectArg: { argFoo: 'bar' } }); | ||
}); | ||
|
||
test('update reactive Args component no arg with all args -> updateArgs()', () => { | ||
const reactiveArgs = reactive({ objectArg: { argFoo: 'foo' } }); // get reference to reactiveArgs or create a new one; | ||
expectTypeOf(reactiveArgs).toMatchTypeOf<Record<string, any>>(); | ||
expectTypeOf(reactiveArgs).toEqualTypeOf<{ | ||
objectArg: { argFoo: string }; | ||
}>(); | ||
|
||
const newArgs = { objectArg: { argFoo: 'bar' } }; | ||
updateArgs(reactiveArgs, newArgs); | ||
|
||
expect(reactiveArgs).toEqual({ objectArg: { argFoo: 'bar' } }); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<script setup lang="ts"> | ||
defineProps({ | ||
label: String, | ||
}); | ||
</script> | ||
<template> | ||
<div> | ||
<header data-testid="header-slot"> | ||
<slot name="header" title="Header title from the slot"></slot> | ||
</header> | ||
<main data-testid="default-slot"> | ||
<slot></slot> | ||
</main> | ||
<footer data-testid="footer-slot"> | ||
<slot name="footer"></slot> | ||
</footer> | ||
</div> | ||
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<!-- <MyComponent> template --> | ||
<script setup lang="ts"> | ||
const props = defineProps({ | ||
label: String, | ||
year: Number, | ||
}); | ||
</script> | ||
<template> | ||
<div data-testid="scoped-slot"> | ||
<slot :text="`Hello ${props.label} from the slot`" :year="props.year"></slot> | ||
</div> | ||
</template> |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Shouldn't we make sure args stay reactive when they get overridden here by an decorator update?
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.
Do we have tests for updating args from a decorator update?