#I need code review, anyone help? thx
47 messages ยท Page 1 of 1 (latest)
I could take a look at the project tomorrow if it is still relevant
@lavish saddle I've made a PR for you with a couple of Note as comments for ideas and suggestions you might consider to implement:
https://github.com/petekgithub/graphql-countryAPI-ts-remix/pull/2
thank you, I'm gonna check and also I need add some other things. I'll inform to u later,
thanks again ๐
no worries ๐ I hope the changes make sense ๐ค Keep us posted how it goes ๐
hey, again, did u pull whole client codes and put inside the index.tsx?
I add commit on github, I just wanted to understad ๐
I am afraid I cannot see the comment on GH :/ Would you be able to share a link with me?
I can see there is another PR opened and his approach should be working as well ๐ค
The blog he posted is a "recent" one about how to add apollo to remix but It also lookd a bit messier than my proposal.
I would recommend you to try out both approaches and try to figure out what the difference is between the two.
yes yes ๐
another friend add PR, I read and try both of them
alright, my question is, why did you take whole client codes and put in the index.tsx
I just wonder that logic?
don't get me wrong,i just curious, I didnt enough knowledge
and the other thing you add some notes like: I would keep this file to the default implementation, what do u mean "default implementation" ?
I only meant by that that I wouldn't necessarily touch that file, I would keep it as it was.
I cannot recall what remix generates for us in that file, but based on the added code I the file it is a very simple component. As their documentation states it, you can of course add client side code there but the _index file feels more natural to use also this file is the entry point of the server to the "client" and the hydration happens from this file.
It felt like you have some duplicated/redundant, client.entry also doesn't feel like the right place for the sort of code you have, as that is pretty much a code that belongs to a specific page not to the entry point of the browser.
alright you're right, thanks. I also tried but there is an issue :/
here is my query:
import { gql } from "@apollo/client";
const GetCountries = gql query GetCountries { countries { name native capital emoji currency languages { code name } } };
export default GetCountries;
and import the index.tsx (remix)
import GetCountries from "../queries/countries.graphql";
const { data, loading, error } = useQuery(GetCountries);
but got an error like this : : Argument of type 'string' is not assignable to parameter of type 'DocumentNode | TypedDocumentNode<any, OperationVariables>'.
I was expecting DocumentNode | TypedDocumentNode<any, OperationVariables>, but you passed string.
I am not sure if I am 100% right, this is just my perception and approach I haven't used remix for a while.
let me see, just a sec
Could you share a branch or PR with the code in it?
It looks like that separating the query and importing it causing some kind of issue.
Which is weird.
hmm, how can I open PR ? hmm 1sec, I'll try
this is not working well right now but I'll push
last commit, I guess I didnt do it well
:/
Alright so the problem was that you had a countries.graphql file
hmm
When you import that file using the import statement you grabbed the file's path which is a string
you need to make that file as a ts or js file then you will be able to import the query correctly
yes
Made a screenshot of the file, its extension, the error is gone and the imported type is correct.
alright, it works ๐ thank you
awesome ๐
which theme are u using?
I think it's night owl