PRJ – 17

Wednesday 26/08: 8AM – 2:45PM

Today I added descriptions to my GraphQL schema. You can add descriptions to pretty much everything in your schema, this makes it easier to identify what the schema is about in the code editor but it also shows up in browser extensions such as Altair GraphQL Client and other tools you can use to manage your GraphQL client like Apollo Studio. These tools let you manage and test your GraphQL schema making it a good place to create and test queries & mutations for your application. When using these tools there is documentation provided about YOUR schema for queries and mutations as well as the values they return and require. The descriptions you set in the code make up this documentation so it’s important to be descriptive and accurate since people using these tools, like your collueagues, probably didn’t write the schema so they’re relying on your descriptions to provide a good explanations of what these values are. All though value naming plays a crucial part in this understanding, sometimes there is a bit more too the values then you can express in a variable name.

Adding these descriptions was also helpful for my own understanding of the business logic surrounding the application. Since I am so new to this business, I don’t know everything about what the business does yet and how the applications we develop interact with business processes.

The rest of the day I spent in a call with one of the other developers sorting out the best way to set the a React state for this image placement I was working on. A child component is passing back a state object which holds X, Y and a scale value as well as product information (alot of which we don’t need or already have). These X, Y and scale co ordinates aswell as the ID of the corresponding product need to be saved in the state of the parent component. One of these objects is being passed back PER sheet you are printing, everytime you drag one of the 3 sliders a value through an onChange event. This is going to result in too many objects to concatinate to an array in the state.

Therefore we have to create an array of objects which hold the X, Y, scale and productId of each sheet being printed in the state of the parent component. Then we use the immutability-helper NPM package to update the correct products X,Y, scale values with the data from the child component by finding the index of the object in the array in the state. My apologies if this doesn’t make sense but I have no better way to explain it without the code.

Leave a comment

Design a site like this with WordPress.com
Get started