Skip to content
Discussion options

You must be logged in to vote

This is a very comprehensive post / question. I thought a bit about it, but I couldn't really come up with a better way than you already have.

I don't think the extra entries in the cache are a problem.

Only thing you could do is not add baseUrl and token to your key. This depends on what you want to do when those keys change. If the baseUrl is static per deployment and getting a new jwt token should not trigger a hard loading state (which I would assume), then you can do:

const useApiData = async () => {
	const { data: config = { baseUrl: null } } = useConfig();
	const { data: app = { jwt: null } } = useAuth();
	
	const { baseUrl } = config;
	const { jwt } = app;
	
	const enabled = !!(ba…

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Answer selected by klaidman
Comment options

You must be logged in to vote
1 reply
@TkDodo
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants