Is it possible to watch state changes from connectGeoSearch mixin?
See original GitHub issueFeature ⚡️
What is your use case for such a feature?
Hi I would like to ask if I can watch changes from state.items
from
connectGeoSearch
mixin?
Currently, I have no information about state.items
see also official docs tutorial for context.
Currently, i need to create a workaround with setTimeout
to get sure the state.items
has been updated. Is there any better solution (subscription, watcher) to let us know when the state has been updated?
- Map.vue (child)
methods: {
async recenterMap() {
console.debug("this.state.items:",this.state.items);
// i need this in an real app to get sure the store has been updated
await new Promise(resolve => setTimeout(resolve, 150));
let geoloc = this.state.items.map(ds => [ds._geoloc.lat, ds._geoloc.lng]);
this.map.fitBounds(geoloc);
}
}
- Index.vue (parent)
onSearch() {
this.$refs.mjmap.recenterMap();
}
What is your proposal
watcher, subscription …
Demo
I tried to rebuild this in a codesandbox with two different fakedata which should replace the current state with math.random (i know poor example): https://codesandbox.io/s/algolia-vue-instantsearch-v3-geosearch-recenter-m9clf
What is the version you are using?
latest.
Issue Analytics
- State:
- Created 4 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
Geo search with Vue InstantSearch - Algolia
We will see how we can leverage the geo search capabilities of Algolia with the connectGeoSearch connector. This demo is built with Google ......
Read more >Watch for Vuex State changes! - DEV Community
If I use the normal watcher on user it gets invoked, but the values don't seem to be there. I can log them...
Read more >instantsearch.js - UNPKG
This feature helps you make more efficient UIs with multiple result lists, autocomplete, nested interfaces and query suggestions. You can read more about...
Read more >How to build a breakfast restaurant locator with nuxtjs and ...
But if you into modern web development with possible wordpress ... do we want to have or where should we :center the map...
Read more >Map markers not updating with v-for (#21) · Issues - GitLab
As you can see, the marker and its contents get shown under the actual map. ... the same problem using a normal array...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Thanks for your answer. Yeah I ended up using watch. Works for me
Is there a reason
watch: { 'state.items' ...
does not work for you?