Giter Club home page Giter Club logo

Comments (5)

ItalyPaleAle avatar ItalyPaleAle commented on September 14, 2024

Can you give me an example of what the issue is?

from svelte-spa-router.

rottmann avatar rottmann commented on September 14, 2024

e.g. some edit view, called with /#/edit/1 press save and after save it pushes automatically to the next record /#/edit/2
Then you click the browser back button and you go back to edit 1, but the scripts are not executed.

We can check the changed id and do some stuff, but things like onMount will be ignored.

<script>
  export let params = {}

  init() // will not be called here on browser back

  $: if (params.id) {
    init()
  }
</script>

from svelte-spa-router.

rottmann avatar rottmann commented on September 14, 2024

I think this problem #56 is similar.

from svelte-spa-router.

ralyodio avatar ralyodio commented on September 14, 2024

Yes, of course it should. That's a fundaemental tenant of usability is don'jt break the back button.

from svelte-spa-router.

ItalyPaleAle avatar ItalyPaleAle commented on September 14, 2024

This does sound a lot like the issue in #56. To recap, the issue is that the Svelte component isn't unmounted and so Svelte doesn't re-mount the component.

The workaround is to listen on changes on the $location store that the router exports, as per the sample code in my example in #56.

from svelte-spa-router.

Related Issues (20)

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.