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

add redirect to link with hash on first app load #286

Closed
plebeius-eth opened this issue Mar 5, 2024 · 3 comments
Closed

add redirect to link with hash on first app load #286

plebeius-eth opened this issue Mar 5, 2024 · 3 comments
Assignees
Labels
enhancement New feature or request invalid This doesn't seem right

Comments

@plebeius-eth
Copy link
Member

it's intended only for the homepage, for the sub link I meant it makes it more likely that users will know about the hash, because they will always see it in the homepage

Esteban Abaroa, [Mar 4, 2024 at 6:23:01 PM]:
not sure, it has downsides, people will always share the app with /# which looks ugly
the upside is you wont forget to add the /#/ when typing in a url

Tom (plebeius.eth), [Mar 4, 2024 at 6:23:41 PM (Mar 4, 2024 at 6:23:52 PM)]:
mmh ok I think that's a net positive

@plebeius-eth plebeius-eth self-assigned this Mar 5, 2024
@plebeius-eth plebeius-eth converted this from a draft issue Mar 5, 2024
@plebeius-eth plebeius-eth added the enhancement New feature or request label Mar 5, 2024
@plebeius-eth
Copy link
Member Author

365b40d

@github-project-automation github-project-automation bot moved this from In Progress to Done in seedit Mar 5, 2024
@estebanabaroa
Copy link
Member

estebanabaroa commented Mar 15, 2024

 useEffect(() => {
    if (!window.location.hash && !isElectron) {
      // Calculate the base URL (protocol + host)
      const baseURL = window.location.protocol + '//' + window.location.host + '/';
      // Redirect to the base URL with `#/`
      window.location.replace(baseURL + '#/');
    }
  }, []);

that won't work if the site is served in a folder, like for example ipfs.io/ipfs/

it also will remove any query string unnecessarily which something else might need eventually and nobody will understand why

I don't think you should be messing with this, not worth it, it's non standard and has unexpected side effects (for example we have no clue if this affects react hash router). But if you insist on having it, the correct way to do it would possibly be

useEffect(() => {
  if (!window.location.hash) {
    window.location.hash = '/'
  }
}, [])

@estebanabaroa estebanabaroa reopened this Mar 15, 2024
@plebeius-eth
Copy link
Member Author

I agree, doesn't seem worth it

@plebeius-eth plebeius-eth closed this as not planned Won't fix, can't repro, duplicate, stale Mar 17, 2024
@plebeius-eth plebeius-eth added the invalid This doesn't seem right label Mar 17, 2024
@plebeius-eth plebeius-eth removed this from seedit Mar 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request invalid This doesn't seem right
Projects
None yet
Development

No branches or pull requests

2 participants