GithubHelp home page GithubHelp logo

Comments (6)

LostCrew avatar LostCrew commented on August 19, 2024 1

Hi @icd2k3 ,
Thank you so much for taking care of testing. Answers:

  • Sadly, at this moment, we're locked with 15 due to work needed to upgrade other libraries
  • None, otherwise I would have reported them here
  • Excellent assumption: I will verify that and get back to you soon

I have tried to use withRouter in combination with withBreadcrumb, in various order and with different configurations. I have even made the attempt to decorate it with redux connect, in hope that that would feed in new props from store upon location change, thus somehow driving the component to re-render. In the end, nothing worked.
Anyways, expect updates with results of my investigations.

from react-router-breadcrumbs-hoc.

icd2k3 avatar icd2k3 commented on August 19, 2024

Thanks for the report @LostCrew!

I tested this in my app and can't repro the issue. Even if there's no breadcrumb matches it still logs an empty array for breadcrumbs in componentWillReceiveProps for me.

Couple questions:

  • Does upgrading to React 16.x.x help?
  • Any errors or warnings in the console?
  • Is it possible your Breadcrumbs component is being blocked from updating higher up the component chain?

You could also try wrapping the whole thing in withRouter from react-router to force updates every time the path changes (although this shouldn't be necessary).

For reference, here's what I tried on my end:

class PureBreadcrumbs extends Component {
  componentWillReceiveProps({ breadcrumbs }) {
    console.log(breadcrumbs);
  }

  render() {
    return <span>yo</span>;
  }
}

export default withBreadcrumbs([
  {
    path: 'test',
    breadcrumb: 'Test',
  },
])(PureBreadcrumbs);

^ the above logs [] to the console

My setup:

from react-router-breadcrumbs-hoc.

icd2k3 avatar icd2k3 commented on August 19, 2024

Thanks @LostCrew - I should have some time this upcoming weekend to run some more tests as well.

In the meantime - I'm wondering what your route config looks like? ... if you're using strings like:

{ path: '/users', breadcrumb: 'Users' }

String rendering is only supported in React 16. So if this is the case you may need to switch to something like:

{ path: '/users', breadcrumb: () => <span>Users</span> }

from react-router-breadcrumbs-hoc.

LostCrew avatar LostCrew commented on August 19, 2024

Hey @icd2k3, some routes have breadcrumb of type string, others are function/component. The ones with string render the string correctly once matched, so I would lean towards excluding React version to be the cause of the issue.
I still have to verify that my Breadcrumbs component updates aren't blocked. ;)

from react-router-breadcrumbs-hoc.

icd2k3 avatar icd2k3 commented on August 19, 2024

Closing due to inactivity - but if it's an issue on my end I'll reopen!

from react-router-breadcrumbs-hoc.

LostCrew avatar LostCrew commented on August 19, 2024

@icd2k3 Good like that, unfortunately we paused the upgrade of react router that involves switching to this new breadcrumbs component until further requirements are provided. Still, I wish someone else would encounter this and be up to move discussion forward.

from react-router-breadcrumbs-hoc.

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.