Comments (7)
swrev dont have s state per se, we determine state based on data and error. We could improve this in the future.
As mentioned, please open issues for stuff that is related to this lib, internal discussions can be done in other private channels!
from sswr.
Isn't isValid related to this lib?
Those exists to make your life easier, you don't really need to use them, they are just computed properties that basically determine certain situation. As noted by ben, swrev don't have an explicit internal state so I can't expose it. Of course you can use both data and error to determine exactly the same, but some people prefer having some handy methods like those, and they are really one liners for me to write :D
from sswr.
Do we really need this issue?
It has no reasoning, no context, no nothing... Can't even tell what the issue is. Sorry, but I expect you to take your time to articulate your question, reasoning and/or problem if you publicly ask for help and even tag someone directly.
PS: this should simply be closed as invalid...
from sswr.
I tagged you because we were talking about state machine in PR. I'm sorry I bothered you.
I meant that maybe it doesn't make sense because to have isValid
because we could evaluate the same situation in our app: using data
and error
.
from sswr.
My statement about state-machines is about internal handling of state inside the lib. This question is about the exposed api-surface to the outside-world. Two different topics.
As said before: Imho the lib should expose one deterministic(!) state.
if you have to write if (state === State.LOADING) { doSomething(); }
or if (isLoading) { doSomething(); }
every time is only syntactic sugar to make it easier for the enduser without any meaningful difference.
Btw, react-query simply exposes both (which is the right call in my opinion).
from sswr.
stuff that is related to this lib
Isn't isValid
related to this lib?
from sswr.
@ConsoleTVs swrev has internal state for sure. Its state isn't just explicitly handled/named as such. That's what I was talking about in my initial comments about statemachines, deterministic state etc :)
from sswr.
Related Issues (20)
- `data` is `undefined` using reactive query HOT 8
- Expose a method to get the cache? HOT 20
- Dependent fetching just doesn't work? HOT 12
- Support synchronous `fetcher` function HOT 3
- `fetcher` is sometimes ignored and it uses the default `fetch` HOT 1
- If `fetcher` returns `null` the revalidation is ignored HOT 1
- make revalidate() fires immediately? HOT 4
- Add `isValidating` prop HOT 1
- revalidateOnMount missing? HOT 2
- Server side rendering SvelteKit example does not work
- SvelteKit - Named export 'SWR' not found HOT 3
- [HELP] Error: Function called outside component initialization
- Add option for polling interval
- Posible vite4 incompatibility HOT 2
- Multiple SWRs in one component keep resetting each other
- Dependent fetching doesn't revalidate when changing to an already cached value
- Svelte 4 support HOT 2
- Difference to @tanstack/svelte-query HOT 1
- Documentation typo: Global configuration options HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sswr.