Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Component fails to list results after route change #26

Closed
mwargan opened this issue Feb 26, 2018 · 17 comments
Closed

Component fails to list results after route change #26

mwargan opened this issue Feb 26, 2018 · 17 comments
Labels

Comments

@mwargan
Copy link

mwargan commented Feb 26, 2018

Hey :P!

It looks like the component is failing to show results after a route change - see https://github.com/mwargan/vuetify-google-autocomplete-simple-example (added a router)

Nothing in the console - gets me thinking if there's any better debugging tool for Vue I could acquire.

Let me know if I can provide more info!

@ewwwgiddings
Copy link

I am having the same issue. When loading directly it works. With route change it fails.

@MadimetjaShika
Copy link
Owner

MadimetjaShika commented Feb 28, 2018 via email

@timothynott
Copy link
Collaborator

Doesn't need to be a route change. I've got the component in a wizard step and if I go back (not using history) it also stops working. I've run a few tests on the events in the component and they all seem to be responding. I'm wondering if this is actually an issue with Google's code. I've had a similar issue with the Google Maps SDK in the past. Looking into it.

@timothynott
Copy link
Collaborator

I adjusted my code to use a v-show instead of v-if for the blocks I was showing/hiding for the wizard and that did the trick. My guess right now is that "googeMapState.initMap" does not get re-triggered and so setupGoogle() does not run

@timothynott
Copy link
Collaborator

timothynott commented Mar 6, 2018

pull req submitted

Would be interested to hear if this fixes the issue for route changes, as well.

@MadimetjaShika
Copy link
Owner

Hi @timothynott

Thanks for the PR, much appreciated! I've merged it in, i'm going to publish a new version just now and will let you know once done.

@MadimetjaShika
Copy link
Owner

I've published the fix under alpha version [email protected].

@mwargan and @ewwwgiddings, please let me know if this resolves the route change issue that you had.

@ewwwgiddings
Copy link

When I load the site on localhost then first thing navigate to the autocomplete's page it does not work. When I load the site and then go to the autocomplete's page indirectly it does work now.

So yes it works better now, and I think it is something with my code that is causing that buggy situation, not with this. I will be looking into why probably some time this week. If I find it to be something other than my code I will let you know. Otherwise, thank you!

@mwargan
Copy link
Author

mwargan commented Mar 8, 2018

Looks like I'm still running into the issue. As mentioned above, it does work better, so a big thumbs up for your continual efforts 👍!

Interestingly, I've noticed that v6 works when routes change as long as the router is saved under a keep-alive. Not yet sure if related, but the first component with autocomplete to load and with keep-alive works great (even after some nav), but if I have another component on another page, that one seems to fail. Will dig deeper and try it out with the simple example you provided and I linked above as soon as I get more time!

@MadimetjaShika
Copy link
Owner

Cool thanks guys. I'll look into this sometime this weekend and let you know when resolved.

@santanubasu
Copy link

Any update on this one? The component works great otherwise, but this one issue is preventing us from using this in production.

@timothynott
Copy link
Collaborator

Submitted another PR tested against route changes with vue-router.

@MadimetjaShika
Copy link
Owner

@timothynott thanks so much for the PR! I've merged and published new version 2.0.0-Alpha.7 👍

I've tested this with route changes and it seems to be working okay now. Thanks again @timothynott!

@timothynott
Copy link
Collaborator

Happy to help

@santanubasu
Copy link

Good stuff, thanks guys. Confirming that this resolves the issue on route change for me.

@MadimetjaShika
Copy link
Owner

MadimetjaShika commented Mar 18, 2018

Closing this issue as resolved. Feel free to re-open if still experiencing the same problem.

@ledermann
Copy link

Just stumble about this issue still present in 2.0.0-beta.4: On first load all is fine, after route changing the result list stays empty. PR #31 seems to be not enough.

Here is my code (of a component using vga, reduced to relevant parts) including a hack to execute setupGoogle on mounting my component:

<template>
  <vuetify-google-autocomplete
      id="map"
      ref="myAddress"
  >
  </vuetify-google-autocomplete>
</template>

<script>
  export default {
    data: () => ({
      myAddress: ''
    }),

    mounted() {
      // Hack, see https://github.com/MadimetjaShika/vuetify-google-autocomplete/issues/26
      if (window.hasOwnProperty('google') && window.google.hasOwnProperty('maps')) {
        this.$refs.myAddress.setupGoogle();
      }
    },
  }
</script>

With the hack in mounted it all works fine.

Versions used:

  • Vue 2.5.16
  • Vuetify 1.1.4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

6 participants