Skip to content

use/useViewUpdate

Overview

Provides all reactive state and behaviour for an update view that fetches a single model instance, presents it in an editable form, and submits changes back to the server. Combines module:use/useDetailView for fetch/display wiring with the submit-side logic (useObjectForm).

Used directly by ViewUpdate.vue and intended as a building block for custom update-view shells in consuming projects.

Examples

vue
<script setup>
import FormConfirmDialog from "@vueda/form/confirm/FormConfirmDialog.vue";
import { useViewUpdate } from "@vueda/use/useViewUpdate.js";
import { provide } from "vue";
import { FormContextSymbol } from "@vueda/utils/symbols.js";

const props = defineProps({ app: String, model: String, pk: String, redirectAfter: String });
const { formContext, objectForm, instance, actions } = useViewUpdate(props);
provide(FormContextSymbol, formContext);
</script>
<template>
    <!-- ...form markup... -->
    <!-- Required: resolves submit-time warning confirmations (HTTP 409); without it warned saves are cancelled. -->
    <FormConfirmDialog :controller="objectForm.confirmation" />
</template>

Methods

  • useViewUpdate - Extracts all reactive state and wiring for an update view of a single model instance.

Types

ViewUpdateContext

ViewUpdateOptions

Required identification.

Source

client/lib/use/useViewUpdate.js:1

Documents matching: server v3.0.0a1.post1client v3.0.0-alpha.2