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

inferno-router: catch Hash history cannot PUSH the same path; #1359

Open
sprlwrksAprilmintacpineda opened this issue Jun 25, 2018 · 3 comments

Comments

@sprlwrksAprilmintacpineda
Copy link

sprlwrksAprilmintacpineda commented Jun 25, 2018

Issue Template

Is there a way to catch this and do something?

Inferno Metadata

macOS
Safari / Chrome / Firefox /
[email protected]

@Havunen
Copy link
Member

Havunen commented Jun 25, 2018

Hi can you give concerete example what you are trying to do please

@aprilmintacpineda
Copy link

@Havunen when the user clicks on a <Link to="/someurl">Go</Link> and he's already on that URL, a warning will show on the console. What I want to do is do state changes on the parent of the Route component.

class App extends Component {
  state = {
    // some state
  }

  handler = () => {
    // handle user already on that path.
  }

  render = () => (
    <Parent>
      <HashRouter>
        <Route onComponentAlreadyHere={this.handler} path="someurl" component={Page} />
      </HashRouter>
    </Parent>
  );
}

@Havunen
Copy link
Member

Havunen commented Jun 26, 2018

I'm not very familiar with the Router code base, maybe @nightwolfz @LukeSheard knows better. Meanwhile you can try to check this out yourself?

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

No branches or pull requests

3 participants