Skip to content
This repository was archived by the owner on Nov 10, 2023. It is now read-only.
This repository was archived by the owner on Nov 10, 2023. It is now read-only.

useLoadsCache should be a typed response #32

@dwjohnston

Description

@dwjohnston

Similar to other issues.

if I do

Somewhere:


export async function fetchUser() : Promise<User> {
    return new Promise((res, rej) => {
        setTimeout(() => {
            res({
                userId: 101
            }); 
        }, 1000)
    }); 
}
    const loadUser = useCallback(fetchUser, []); 

...

   const { response: userResponse, isPending: userIsPending,  } = useLoads(loadUser, {
        context: 'user'
    });

Elsewhere

const user = useLoadsCache('user'); 

The signature should be the same as the the function I pased to useLoads, ie User | undefined.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions