fix: cleanup old keys and use shallowReactive instead of reactive for dataReactive and pageContextReactive #116, #121#120
Conversation
|
A fix for |
|
I think I found a use case where this unfortunately doesn't work. Let me try to reproduce on |
|
BTW, if we want to treat |
|
984ef60 breaks this PR. To reproduce:
|
|
It looks like we need to return the full ref, so the DX changes in JS/TS (stays the same in template) |
Maybe a hack would be: const dataRef = ref(data)
Object.assign(dataRef, data)Not sure if it's worth it. I don't know whether |
Not weird DX, especially if editor interprets TS types you get full autocomplete
I'm not sure where would that fit |
|
Ok 👍 On my side I think we should go for this Thoughts on |
|
I'll clean up this PR and let's move to another issue for |
|
👍 And let's also decide about |
|
Cleanup done here and opened sibling issue #121 |
4bf79b5 to
7fbfcea
Compare
… dataReactive and pageContextReactive vikejs#116, vikejs#121 BREAKING CHANGE: data from `+data` hook must be a non-array object (if you need to return a list wrap it in an object) BREAKING CHANGE: both `useData` and `usePageContext` return `shallowReactive` instead of `reactive`
useData while keeping the same DX #116|
This should be now ready |
|
I made some minor changes, let me know if you disagree with something. Otherwise I'll squash, merge, and release. |
|
LGTM |
|
Merged 🎉 Thank you the neat collaboration 💚 |
|
And released as @4350pChris I went ahead without your input because this PR fixes a couple of bugs without introducing any (conceptual) breaking change. But I'm more than happy to have the conversation whether we should go for |
BREAKING CHANGE: data from
+datahook must be a non-array object (if you need to return a list wrap it in an object)BREAKING CHANGE: both
useDataandusePageContextreturnshallowReactiveinstead ofreactivecloses #116, closes #121