Replies: 1 comment
-
Ok, I understood why it's readonly. // useData.js
import { ref, watch } from 'vue'
export const useData = (refData) => {
const editableData = ref(null)
if (refData && refData.value) {
editableData.value = clone(refData.value)
}
watch(
() => refData.value,
(newVal) => {
editableData.value = clone(newVal)
},
)
return editableData
}
const clone = (value) => {
return JSON.parse(JSON.stringify(value))
} Usage: const { isLoading, data } = useTodosQuery()
const todos= useData(data) I think later I will add something like ignored field while updating to save some fields like |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I have a situation where I get the data from the server, transform and send it back. But the data is readonly. Can you explain why and maybe add an option
{ readonly: false }
to theuseQuery
function?Beta Was this translation helpful? Give feedback.
All reactions