Comments (3)
@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.
@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.
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)
- Assets HOT 1
- How to display values from database in real time with apollo client 3 and react js?
- Persisting cache to localstorage
- JSX examples - Moving from Redux to Apollo Client 3
- Real-world example? HOT 1
- Looking for example of pagination using custom field types (relay)
- Property 'onNextChange' is missing in type HOT 3
- Looking for example with remote data combined with local data
- Strategy to make the local state persisting HOT 6
- the cache empty when running the apollo-local-state project
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ac3-state-management-examples.