Skip to content

Commit

Permalink
more log
Browse files Browse the repository at this point in the history
  • Loading branch information
AlecAivazis committed Oct 19, 2023
1 parent 68e6d3d commit eafbcc9
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions packages/houdini-react/src/runtime/routing/Router.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -167,11 +167,14 @@ function usePageData({
last_variables.set(artifact, variables)
}

console.log('loading query', artifact.name)

// TODO: AbortController on send()
// TODO: we can read from cache here before making an asynchronous network call

// if there is a pending request and we were asked to load, don't do anything
if (ssr_signals.has(id)) {
console.log('using ssr signal')
return ssr_signals.get(id)!
}

Expand All @@ -184,6 +187,7 @@ function usePageData({
resolve = res
reject = rej

console.log('sending query', id, variables)
observer
.send({
variables: variables,
Expand Down Expand Up @@ -299,7 +303,6 @@ function usePageData({

// before we can compare we need to only look at the variables that the artifact cares about
if (Object.keys(usedVariables ?? {}).length > 0 && !deepEquals(last, usedVariables)) {
console.log('clearing cache', artifact, last, usedVariables)
data_cache.delete(artifact)
}
}
Expand Down Expand Up @@ -352,8 +355,6 @@ function usePageData({
load_query({ id: artifact.name, artifact })
}
}

console.log('data cache', data_cache)
}

// if we don't have the component then we need to load it, save it in the cache, and
Expand Down Expand Up @@ -515,12 +516,10 @@ const VariableContext = React.createContext<GraphQLVariables>(null)
export function useQueryResult<_Data extends GraphQLObject, _Input extends GraphQLVariables>(
name: string
): [_Data | null, DocumentStore<_Data, _Input>] {
console.log('waiting for', name)
const store_ref = useRouterContext().data_cache.get(name)! as unknown as DocumentStore<
_Data,
_Input
>
console.log('store ref', name, store_ref)
// get the live data from the store
const [{ data }, observer] = useDocumentStore<_Data, _Input>({
artifact: store_ref.artifact,
Expand Down

0 comments on commit eafbcc9

Please sign in to comment.