Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Removes avoidable React useEffect usage and replaces it with render derivation, event handlers, or existing hooks in Langfuse frontend code.
68% 72%+4 ptsof test cases passed
Passed 18 of 25 test cases with the skill, and 17 of 25 without it.
3 of 3 safety checks passed
Not used yet
Use the smallest pattern that makes ownership and lifecycle explicit.
Do not mount a stateful form with missing defaults and repair it after paint. Let the query-owning parent render the loading/error state. Mount the form only with complete initial values.
function UserFormContainer({ userId }: { userId: string }) {
const userQuery = api.users.byId.useQuery({ userId });
if (userQuery.isPending) return <Spinner />;
if (userQuery.isError) return <ErrorPage />;
const initialValues = toUserFormValues(userQuery.data);
return <UserForm key={userQuery.data.id} initialValues={initialValues} />;
}
function UserForm({ initialValues }: { initialValues: UserFormValues }) {
const [values, setValues] = useState(() => initialValues);
return <UserFields values={values} onChange={setValues} />;
}
The key expresses that changing to another user discards the previous draft.
Do not include a query update timestamp or version in the key unless every
refetch should intentionally discard edits. If users must choose when to adopt
fresh server values, expose a reset/refresh action instead.
Keep the user's stored intent and derive whether it is currently valid. Do not overwrite a selection store every time query data changes.
Skills that do similar work, with their benchmark result.
Next to this one in the catalogue, plus more from the same author.