New format for universal componets #26874
Replies: 2 comments 3 replies
-
that sounds like an amazing idea to be honest, but I believe props and server data are different, I would suggest something like this: let { response, error, refresh } = defineResponse<{
user: {
name: String
id: UUID
...
}
}>() |
Beta Was this translation helpful? Give feedback.
-
I agree there should be a better server-client seperation where we can just navigate to a route and wait server-side actions to be completed while the client is fully functional. Yes I know there is a It will change and definitely improve the way we write. My suggestion for this is; <script server lang="ts">
const someData = ref("");
// some logic here
// (extra idea)
onServerEventTrigger("refreshData", () => {
// use another logic to mutate someData
});
respondWith({
someData
});
</script>
<script setup lang="ts">
const { someData } = fromServer<T>();
// use someData here reactively
triggerServerEvent("refreshData");
</script> Additional Information about
|
Beta Was this translation helpful? Give feedback.
-
The Nuxt team could achieve something like inertia or call api based on same component path,
where server logic for particular page or vue component can be written in same file.
it may be achieved using different server section or different file in same path as well.
Current Method
If one has to create api or any error or bug occurs in api,
One has to follow following path in most case
Proposed method 1
Having server code in same file
Proposed method 2
Writing server code in different file but in same path
in this way we can keep our client files as it is
Beta Was this translation helpful? Give feedback.
All reactions