He
HeliumTS
Note:

HeliumTS is under pre-beta and active development. Expect bugs and breaking changes. If you find any issues, please report them in our GitHub

A stable release is planned for early December 2025.

Data Mutation

HeliumTS provides the useCall hook for performing mutations (create, update, delete operations). Unlike useFetch, it doesn't automatically execute — you call it manually when needed.

useCall

The useCall hook is designed for writing/modifying data. It provides a function to trigger the server method and tracks the execution state.

Basic Usage

1import { useCall } from "heliumts/client";
2import { createTask } from "heliumts/server";
3
4function CreateTaskForm() {
5 const { call, isCalling, error } = useCall(createTask);
6
7 const handleSubmit = async (name: string) => {
8 const result = await call({ name });
9 if (result) {
10 console.log("Task created:", result);
11 }
12 };
13
14 return (
15 <form
16 onSubmit={(e) => {
17 e.preventDefault();
18 handleSubmit(e.target.taskName.value);
19 }}
20 >
21 <input name="taskName" placeholder="Task name" />
22 <button type="submit" disabled={isCalling}>
23 {isCalling ? "Creating..." : "Create Task"}
24 </button>
25 {error && <p className="error">{error}</p>}
26 </form>
27 );
28}

Return Values

PropertyTypeDescription
call(args: TArgs) => Promise<TResult | undefined>Function to execute the server method
isCallingbooleanWhether a call is in progress
errorstring | nullError message if the call failed
statsRpcStats | nullRPC statistics (timing, etc.)

Options

1const { call } = useCall(method, {
2 invalidate: [getTasks, getTaskCount],
3 onSuccess: (result) => console.log("Success:", result),
4 onError: (error) => console.error("Error:", error),
5});
OptionTypeDescription
invalidateMethodStub[]Array of methods whose cached data should be invalidated after a successful call. This triggers automatic refetch for all useFetch hooks using those methods.
onSuccess(result: TResult) => voidCallback fired after a successful call
onError(error: string) => voidCallback fired when the call fails