GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — InMemoryCache · Issue #20 · javascripteverywhere/web

InMemoryCache #20

New issue
Copy link
New issue
Copy link
Open
Open
InMemoryCache#20
Copy link

Description

@ivonakov
ivonakov
opened on Mar 28, 2020
Issue body actions

web/final/App.js

Line 7 in 26319b2

InMemoryCache

The InMemoryCache class resides in a different package from the Apollo Client core. Make sure the apollo-cache-inmemory package is installed in your project

https://www.apollographql.com/docs/react/caching/cache-configuration/

web/final/App.js

Line 45 in 26319b2

cache.writeData({ data });

=> Uncaught TypeError: cache.writeData is not a function at Object.parcelRequire.App.js.react (App.js:45)

Reacted by Michael Westbay

Activity

  1. ascott1 commented on May 4, 2020

    @ascott1
    ascott1
    on May 4, 2020
    Collaborator
    More actions

    For anyone who comes across this issue, we discuss it in more detail here: https://spectrum.chat/jseverywhere/general/chapter-15-web-authentication-and-state-issue-with-cache-writedata~998a84e5-9caa-4dab-bccb-d97fea79c1b1

    The tl;dr summary is:
    If you are using this repo as a starter project as shown in the book, you should not experience this issue.

    However, when using the latest version of Apollo the two packages need to be installed separately:

    import { ApolloClient, ApolloProvider, createHttpLink } from '@apollo/client';
    import { InMemoryCache } from 'apollo-cache-inmemory';
    

    Otherwise, the code should be the same.

    Hopefully that helps!

  2. cip123 commented on May 15, 2020

    @cip123
    cip123
    on May 15, 2020
    More actions

    I think this is related to this issue, @appolo/client removed client.writeData in version 3.0.0-beta.48 so the signIn code is no longer working.
    I tried this workaround

    client.cache.writeData({ data: { isLoggedIn: true } });
    

    but now the problem is that

     const { loading, error, data } = useQuery(IS_LOGGED_IN);
    

    in PrivateRoute is returning stale data after the succesful login redirect so I need to log in twice

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402503 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.