One of the things I dislike most about my workweek is generating my invoice. I don’t know why but I always procrastinate when it comes to sending it in. So I spent some time working through how to import my time data directly into Google Sheets so I can make the process as painless as possible.

Tools used

  • Toggl: Time tracking — This is software (has a free tier) that will easily allow you to track your time based on the project, client, etc. They have a chrome plugin to make things easy to start/stop the clock. https://toggl.com/track/

In our tech stack, we are starting to move into creating more protected fields. In this article, I am going to share a function that has become useful to me and reduced some of the redundancy in checking if a viewer has access to a field on a type.

Preface: Using the Viewer Pattern

This is a common GQL Pattern that uses user based fields. If you need more information here are a couple of great resources

* https://stackoverflow.com/questions/37635328/what-is-the-meaning-of-viewer-field-in-graphql

* https://medium.com/workflowgen/graphql-schema-design-the-viewer-field-aeabfacffe72

On Apollo server the credentials are generally stored in the context

* https://www.apollographql.com/docs/apollo-server/data/resolvers/#the-context-argument

A resolver “Wrapper”

There are plenty of ways to create auth, that’s beyond the…


I have been doing a lot of performance tracking in GQL lately. Picking apart resolvers that seem to work fine but when scaled are having some major spikes in latency. Often going rom sub 1s to 8+ seconds. We just cant have that happen in todays tech world.

As I was dropping logs all around the functions I figured it would be better to abstract it into something that resembles a react hook.

const useTimeTracker = () => {const startTime = new Date().getTime();let last = startTime * 1;let cur;const tick = statement => {cur =…


Other parts of this series:
useQuery: https://levelup.gitconnected.com/apollo-client-typescript-hook-patterns-33353b6315a1

The useMutation hook is powerful. A little refresh on useMutation and Apollo Client. When you send off a mutation you are modifying data on your server/client. The mutation will return a new data set. Apollo client will automatically update your local state/cache with this new data providing you return the proper primary key (default is id). The goal of this pattern is to store that modification logic in a single place.

If you have not looked at part one to see folder structure check it out first. …


We have seen a lot of great new things out of React and Apollo in the last 18 months. Arguably, hooks are one of the most important changes. In my opinion, they have had the most impact on the structure, look, and feel of our codebases. I spent some time with another developer, Ben Lacy, hashing out how we wanted our hook structure to look and this is what we have found to be the most useful. This is part 1/3 and covers folder structure and useQuery. Look for useMutation and useLazyQuery articles soon.

Folder Structure

Previously

In a previous project that was…

Kenny Hammerlund

Just a guy that likes to build cool things

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store