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

function updateSlug() glitching due to location.pathname.slice(-32) #58

Open
partham16 opened this issue Oct 29, 2020 · 0 comments
Open

Comments

@partham16
Copy link

return location.pathname.slice(-32);

↑↑↑ Here in this line for function getPage(), the slice causes slug to misbehave in specific cases where slug might be more than that length.

Case in Point:

> PAGE_TO_SLUG
{something-something-0d44ee0e01944fabbb047c7bb9f885fd: "demo3", 
4569ee8b29d64be6b8cb25be1f9123b0: "demo2"}

Here demo2 gets history.replaceState correctly, but, demo3 doesn't!

Simply changing the function to :

function getPage() {
        return location.pathname.slice(1);
      }

should work.

partham16 added a commit to partham16/fruitionsite that referenced this issue Oct 29, 2020
Currently `getPage` returns `location.pathname.slice(-32)`
 This raises `slug` to not found when the pathname is longer
partham16 added a commit to partham16/notion-cloudflare that referenced this issue Oct 30, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant