# Upgrading to 1.9.0

# Introduction

The main and the most important change was implementation of the init function for a performance boost and rework of the token flow logic, which was a necessary step after the usage of the init function.

# Init function

Previously, Apollo Client was created on every request which was not a very good solution in terms of performance. Utilizing the new core mechanism we implemented the init function to bootstrap the client once on the build time.

File What was changed
[!] packages/api-client/src/index.server.ts Move client creation logic from the onCreate to the init function

For a reference please check getInitConfig (opens new window) in the middleware package.

# Token flow

Due to tokens leaks and security issues after the implementation of the init function, token flow was reworked.

File What was changed
[!] packages/api-client/src/token/TokenManagerFactory.ts Creates object with helpers for reading and creating access token cookies and accessing current token provider
[!] packages/api-client/src/token/tokenParser.ts Parses raw token string into an object
[!] packages/api-client/src/links/** All Apollo Client links related factories and handlers
[!] packages/api-client/src/links/createLinks.ts Main entry point for links creation

# Token Flow Diagrams

Application bootstrap Reequest flow overview Request handler Before auth handler After auth handler