Skip to content

Commit

Permalink
fix(app): do not cache graphql (#18716)
Browse files Browse the repository at this point in the history
* do not cache graphql

* reduce need to access this.ctx.graphql

* Apply suggestions from code review

Co-authored-by: Tim Griesser <[email protected]>

Co-authored-by: Tim Griesser <[email protected]>
  • Loading branch information
lmiller1990 and tgriesser authored Nov 1, 2021
1 parent 789724a commit a064d1c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
3 changes: 1 addition & 2 deletions packages/data-context/src/DataContextShell.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,7 @@ export class DataContextShell {
return new DataEmitterActions(this)
}

@cached
get graphql () {
graphqlClient () {
return new GraphQLDataSource(this, this.shellConfig.schema)
}

Expand Down
14 changes: 8 additions & 6 deletions packages/data-context/src/sources/HtmlDataSource.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,17 @@ export class HtmlDataSource {
constructor (private ctx: DataContextShell) {}

async fetchAppInitialData () {
const graphql = this.ctx.graphqlClient()

await Promise.all([
this.ctx.graphql.executeQuery('AppQueryDocument', {}),
this.ctx.graphql.executeQuery('NewSpec_NewSpecQueryDocument', {}),
this.ctx.graphql.executeQuery('ProjectSettingsDocument', {}),
this.ctx.graphql.executeQuery('SpecsPageContainerDocument', {}),
this.ctx.graphql.executeQuery('HeaderBar_HeaderBarQueryDocument', {}),
graphql.executeQuery('AppQueryDocument', {}),
graphql.executeQuery('NewSpec_NewSpecQueryDocument', {}),
graphql.executeQuery('ProjectSettingsDocument', {}),
graphql.executeQuery('SpecsPageContainerDocument', {}),
graphql.executeQuery('HeaderBar_HeaderBarQueryDocument', {}),
])

return this.ctx.graphql.getSSRData()
return graphql.getSSRData()
}

async fetchAppHtml () {
Expand Down

0 comments on commit a064d1c

Please sign in to comment.