Skip to content

useListRepository

Internal composable for directly mutating list/table item data in the global reactive store — without triggering a full reload.

Parameters

ParamTypeDescription
keystringList/table identifier (same as id prop)

Returns

MethodSignatureDescription
removeList() => voidClears all data for this list
collectListValues<T>() => List<T>Returns current list state
updateListItemValue(itemId, value, itemKey?) => voidUpdate a specific item
deleteListItemValue(itemId) => voidRemove an item from the list

Exported Helpers

Import directly without instantiating the composable:

typescript
import { updateItemKeyValue, updateItemValue, deleteItemValue } from "@qnx/vuetify";
HelperSignatureDescription
updateItemKeyValue(listId, itemId, key, value) => voidUpdate one field of one item
updateItemValue(listId, itemId, value) => voidReplace an entire item object
deleteItemValue(listId, itemId) => voidRemove an item from the list

When to Use

Use these helpers when you want to update the UI immediately after an in-place action — without reloading the entire table from the server.

Update a Single Field

Toggle a user's status in the table after a toggle action:

typescript
import { updateItemKeyValue } from "@qnx/vuetify";

// After a successful PATCH request:
updateItemKeyValue("users", String(userId), "status", "inactive");
vue
<script setup>
import { updateItemKeyValue, useMessageInstance } from "@qnx/vuetify";
import axios from "axios";

const message = useMessageInstance();

const toggleStatus = async (user) => {
  const newStatus = user.status === "active" ? "inactive" : "active";
  try {
    await axios.put(`users/${user.id}/status`, { status: newStatus });
    updateItemKeyValue("users", String(user.id), "status", newStatus);
    message.success("Status updated!");
  } catch {
    message.error("Failed to update status.");
  }
};
</script>

<template #item="{ item }">
  <tr>
    <td>{{ item.name }}</td>
    <td>
      <v-switch
        :model-value="item.status === 'active'"
        @update:model-value="toggleStatus(item)"
        hide-details
      />
    </td>
  </tr>
</template>

Replace an Entire Item

typescript
import { updateItemValue } from "@qnx/vuetify";

// After a successful PUT request that returns the updated item:
const updated = await axios.put(`users/${id}`, payload);
updateItemValue("users", String(id), updated.data);

Delete an Item Without Reloading

typescript
import { deleteItemValue } from "@qnx/vuetify";

// After a successful DELETE request:
await axios.delete(`users/${id}`);
deleteItemValue("users", String(id));