GithubHelp home page GithubHelp logo

Comments (3)

stemmlerjs avatar stemmlerjs commented on April 28, 2024

@caycecollins, I know we were running into a few snags earlier last month with UI reactivity and getting reactive variables hooked up. I would love to hear how it's working for you now that we've tightened up AC3 with the official release.

from ac3-state-management-examples.

caycecollins avatar caycecollins commented on April 28, 2024

@stemmlerjs thanks for the response. I just updated to 3.0.1 today and it doesn't appear to be resolved. It should be noted that I am using gatsby for this project, which I'm hoping isn't causing any additional issues here.

Here's some code about my specific implementation:

I have a modal component that uses a reactive variable to control it's open/close state:

const { data: { loginModal } = {} } = useQuery(GET_LOGIN_MODAL)
const { isOpen } = loginModal
const [showModal, setModalVisibility] = React.useState(false)

React.useEffect(() => {
  setModalVisibility(isOpen)
}, [isOpen])

const handleModalClose = () => {
  updateLoginModal({ isOpen: false })
}

Query:

import { gql } from "@apollo/client"

export const GET_LOGIN_MODAL = gql`
  query GetLoginModal {
    loginModal @client {
      isOpen
    }
  }
`

Mutation:

import { loginModalVar } from "../cache"

export const updateLoginModal = ({ isOpen }) => loginModalVar({ isOpen })

I am unable to open/close the modal after an HMR update. I added a log statement before and after the update in the mutation and it does properly change the variable, but the query in my modal component no longer receives update about it's change.

from ac3-state-management-examples.

caycecollins avatar caycecollins commented on April 28, 2024

I'm still unable to resolve the issue but wanted to reference the open issues in the apollo-client repository which have some better explanations, examples, and outline efforts being taken to resolve the issue(s):
apollographql/apollo-client#6661
apollographql/apollo-client#5870

from ac3-state-management-examples.

Related Issues (11)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.