Comments (6)
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.
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:
- [email protected] <----- only difference from your setup
- [email protected]
- [email protected]
- [email protected]
from react-router-breadcrumbs-hoc.
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.
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.
Closing due to inactivity - but if it's an issue on my end I'll reopen!
from react-router-breadcrumbs-hoc.
@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)
- Translated breadcrumbs (delaying routes init) HOT 1
- dassad
- Unnecessary peer dependency on react-router-dom HOT 4
- "//" produces double matches HOT 1
- Unable to pass additional props. HOT 3
- define breadcrumb‘s description HOT 2
- Disabling default generated breadcrumbs by passing breadcrumb: null raises an error HOT 2
- Property 'match' does not exist on type 'ReactNode' HOT 1
- What to use instead of InjectedProps HOT 3
- Replacing react-router with react-router-dom HOT 2
- Fixed
- Suppress autmatically added Home Breadcrumb HOT 2
- Issue with excludePaths not being consistent with breadcrumbs: null HOT 6
- Question about type definition HOT 3
- typescript definition mistake HOT 1
- How do I add in between crumbs ? HOT 2
- Question: Is there a way to not export the current page in breadcrumbs HOT 2
- Question: breadcrumbs propTypes HOT 1
- How to remove "-" from titles HOT 3
- react-router v6 HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react-router-breadcrumbs-hoc.