Skip to content

Can I use this to cache client loader data too? #6

@kiastorm

Description

@kiastorm

This is working great for server data - but in my usecase I am fetching data in the client loader that I also want to cache. Below is some rough code of what I'm trying to do - is this possible?

export async function clientLoader(args: ClientLoaderFunctionArgs) {
	const cache = await cacheClientLoader(args, {
		type: 'swr',
	})

	if (cache.whiteboards) {
		console.log(cache)
		return cache
	}

	const { serverLoader } = args
	const server = (await serverLoader()) as {}

	const whiteboards = await getAllLocalWhiteboards()

	return {
		...server,
		whiteboards,
	}
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions