Skip to content

Is data fetching using SWR necessary? #89

Answered by gokulkrishh
devevignesh asked this question in Q&A
Discussion options

You must be logged in to vote

@devevignesh Hi, Sure let me explain. For couple of reasons i choose SWR library and doing most of my GET requests in client side.

  1. In one place, i am calling userInfo in server side like here. If you look at the code i need to pass cookies to make it work because latest supabase using cookies for auth (previously i think localStorage)
  2. Expense.fyi Data depends on the two things
      1. Overview page - It depends on client side component which is datePicker
      1. Other pages - it depends on the select component (All, this week or this Month).
    • Hence i went with the client instead of server side.
  3. SWR does caches the network requests (GET for this app only).

I think i can move some of API from …

Replies: 1 comment 1 reply

Comment options

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

Answer selected by devevignesh
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