-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
fix(setQueryData). When there is no previous instance of the query it tries to create a new one but the type signature was incorrect #644
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
… tries to create a new one but the type signature was incorrect
|
I’ve considered a small bit of TS. I’m not ready to pull the trigger yet though. As for the classes, I know that’s a possibility, but I just prefer the object based pattern. What advantages are you referring to? |
|
So the benefit I see is structural and syntactic/ergonomic. And I totally see your point of using functions and regular objects, in fact your approach is very similar to what Douglas Crockford proposes in "Javascript: the good parts", in fact what we are trying to represent is data+logic, there are a variety of ways of handling this and all of them have their pros and cons and I completely agree that a lot of it boils down to personal preference and style. structural Although making them classes won't necessarily force us to move them to their own file, it probably will tenderly carry us over there. As I said, the Query and QueryCache are super important and fundamental types in this lib so having a class for them makes sense (BTW I am not a class/oop fundamentalist at all, but I do see the value in certain situations). Also, having the two in two different files seems a good way to break them apart as individual units of logic/data abstraction (more on this later). Interface. Right now is difficult to understand what variables/data/state are part of the "instance" of say a Query and which of them are not (let's say they are modules, helper functions, etc etc like Instead of letting queries call Syntax/Ergonomics Interface part 2. Right now we are using a combination of for example public methods like Semantics. Classes have a bit more clear (and boring) semantics for public and private instance variables and methods and they also have a clear semantic for instantiating i.e. With a lot of this combined together you get IMO
A lot of this could be achieved with your current style but would require more discipline and conventions. Enough rumbling. Thanks a lot for taking the time to hear me out. I appreciate you and your work a lot. Thank you. Fully respectfully |
|
🎉 This PR is included in version 2.4.3 🎉 The release is available on: Your semantic-release bot 📦🚀 |
|
All valid points for sure. I think after going through this I would like to at least move all of the different concepts to their own files (queryCache.js, query.js, queryInstance.js) like you suggested. That's at least a step in the right direction. I would still like to keep the object-builder style around for now and keep an open mind to gradually and naturally make some of these changes in the future. |
|
sure, that totally makes sense. Thinking out loud, it seems that you'd only
have `query.js` and `queryCache.js` (in the core module), a query instance
is just that, an object that comes out of the `query.js` factory.
…On Sun, Jun 28, 2020 at 5:24 PM Tanner Linsley ***@***.***> wrote:
All valid points for sure. I think after going through this I would like
to at least move all of the different concepts to their own files
(queryCache.js, query.js, queryInstance.js). That's at least a step in the
right direction. I would still like to keep the object-builder style around
for now and keep an open mind to gradually and naturally make some of these
changes in the future.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#644 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAOEIJZNZMSW74EZXMETQN3RY6RI3ANCNFSM4OKGUJCQ>
.
|
The 2.x version of this reported bug #639
While I was trying to reproduce the reported bug in the 2.x branch I realized that the bug was not present
due to a incorrect function call to
buildQueryin the problematic code (problematic respect to the code).I fixed that and left the queryFn to be
undefinedto avoid going into the problem condition as explained in the bug.had to fix tests too.
Bonus:
makeQueryas a function instead of as a class?queryCacheis modeled as an object with methods and attributes instead of a class and an instance? The both seem like central "entities" in the library that are instantiated more than once, so they fit the class/instance model pretty well, and with the new syntax they became pretty powerful.The last two seem like a good use case for classes that could improve the code a little bit.
Respectfully
Fran