Better handle falsy values in Select & GraphQL cells
Signed-off-by: Émile Ré <nemile.re@gmail.com>
This commit is contained in:
@@ -24,7 +24,7 @@ type Props<Q extends OperationType, T> = {
|
||||
| { defaultValue: T[]; multiple: true }
|
||||
);
|
||||
|
||||
export function GraphQLCell<Q extends OperationType, T>(props: Props<Q, T>) {
|
||||
export function GraphQLCell<Q extends OperationType, T extends NonNullable<unknown>>(props: Props<Q, T>) {
|
||||
const [value, setValue, valueRef] = useStateWithRef<T | T[] | undefined>(
|
||||
props.defaultValue,
|
||||
);
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import type { GraphQLTaggedNode } from "relay-runtime";
|
||||
import { useMutation } from "react-relay";
|
||||
|
||||
export type MutationFieldUpdate<T> = (
|
||||
field: keyof T,
|
||||
value: T[typeof field],
|
||||
export type MutationFieldUpdate<T extends Record<string, unknown>, TKey extends keyof T> = (
|
||||
field: TKey,
|
||||
value: T[TKey],
|
||||
) => void;
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user