VVibeFlui

Action Execution

Action execution is the runtime path for delete, row actions, bulk actions, toolbar actions, and submit-backed create/update operations.

Resolution priority

resolveAction() chooses an execution source in this order:

  1. action.handler.
  2. schema.handlers[action.key].
  3. schema.handlers[operation].
  4. schema.provider.
  5. action.endpoint or schema.endpoint.
  6. none.

Handlers win over providers and endpoints. Providers win over direct endpoint execution.

Handler action

TS
export const usersSchema = {
  resource: "users",
  actions: {
    row: [
      {
        key: "archive",
        label: "Archive",
        handler: "users.archive"
      }
    ]
  },
  registry: {
    actionHandlers: ["users.archive"]
  }
} as const;
TS
import { createRegistry } from "@vibeflui/core";

export const registry = createRegistry({
  actionHandlers: {
    "users.archive": async ({ row }) => {
      return {
        status: true,
        code: 200,
        message: `Archived ${String(row?.name ?? "user")}`
      };
    }
  }
});

Endpoint action

TS
export const usersSchema = {
  resource: "users",
  identity: {
    key: "id",
    param: "id"
  },
  actions: {
    row: [
      {
        key: "archive",
        label: "Archive",
        endpoint: { url: "/api/users/:id/archive", method: "POST" }
      }
    ]
  }
} as const;

Provider action

TS
export const usersSchema = {
  resource: "users",
  provider: {
    type: "custom",
    name: "admin"
  },
  actions: {
    row: [
      { key: "archive", label: "Archive" }
    ]
  }
} as const;
TSX
const providers = {
  admin: {
    action: async ({ operation, params }) => {
      return runUserAction(operation, params);
    }
  }
};

Readonly mode

Readonly mode blocks mutation operations. Runtime still allows list, detail, view, and options.

Refresh behavior

After successful row, bulk, or toolbar actions, FluiKit reloads the list unless action.refreshOnSuccess === false.

Common mistakes

  • When both handler and endpoint are configured, handler resolution wins and the endpoint is passed only as context.
  • Row identity depends on identity.key pointing to a value in the row.
  • Readonly UI mode disables mutation actions.