Coder Social home page Coder Social logo

svelte-pathfinder's Issues

$query store prototype

Because a $query store have String prototype there may be property name conflicts.

import { query } from 'svelte-pathfinder'

console.log($query.search) // function String.search by default
$query.search = 'test'
console.log($query.search) // string 'test'

Maybe need to rewrite a $query store to an object with a toString() function that returns '?one=1&second=2&...' string?

Nested routes

Thank you for this library.

This routing approach is completely different from what I'm used to.

Is it possible to implement nested routes (or layout route) with pathfinder?

Something similar to

const routes = [
  {
    path: '/*',
    component: AppShell,
    children: [
      {
        path: 'user',
        component: User,
      }
    ],
  }
]

/user would match both / and user and user would render in a <slot /> inside AppShell

Linking to path with query parameter triggers two history changes

Current Behavior

From path "/"
<a href={${path}?=${query}}>Link with Query

Then from "{path}"
function back() results in url /${path}
pressing browser back button results in the same behavior

Desired Behavior

<a href={${path}?=${query}}>Link with Query
would result in one history change, back button would return to "/" not "{path}"

Warning after Vite 5 update

After update to Vite v5.0 there are warning in the console:

[vite-plugin-svelte] WARNING: The following packages have a svelte field in their package.json but no exports condition for svelte.

[email protected]

Please see https://github.com/sveltejs/vite-plugin-svelte/blob/main/docs/faq.md#missing-exports-condition for details.

Everything builds and works just fine.

"unload" event is deprecated

Hello,

First off great work on the router, it's very handy and some of its features were impossible to find in others, love it!

Recently on a project checking the Lighthouse report, I noticed the score from "best practises" went from 100 to 78 because it detected some deprecated API usage. After a bit of digging I realized it was coming from svelte-pathfinder usage of the unload event, which seems outdated: https://developer.mozilla.org/en-US/docs/Web/API/Window/unload_event

Would it be possible to work around it somehow?
Cheers.

Why page reloads?

Do I completely misunderstand the intention of routers? Why is your router reloading the pages? Isn't the purpose of a router in an SPA suppose to NOT reload the page???? How is state to persist with this design?

Possible to preserve paths on page refresh?

I'm noticing that whether I use prefs.hashbang = true; or not, when I'm on a route that isn't the root and I refresh the page, places where I use $pattern have become empty. Is there any way to make this persistent?

Redirect & browser history navbutton

How to reason with the navigation with the history buttons of the browser..?
To obey the conditions of the router ๐Ÿ˜

<script>
  if(!authed) goto('/auth')
  
  //  $authed -> exclude /auth
  // !$authed -> only /auth
</script>

{#if !authed}
  <Auth />
{:else}
  <OtherRoutes />
{/if}

If you enter the address in the line, it works ok, just like the page reload ... and the history buttons live their own life ๐Ÿ˜ continuing to change the link in the address bar, although the router shows what is needed ...

Example repo

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.