question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Love your work here @icd2k3! Found it reading through https://github.com/ReactTraining/react-router/issues/4556.

I think we can do something to improve the defaults and avoid configuration for most cases. Here’s how:

Instead of requiring this object every time you’re going to use the HOC

const routes = [
  { path: '/', breadcrumb: 'Home' },
  { path: '/users', breadcrumb: 'Users' },
  { path: '/users/:userId', breadcrumb: UserBreadcrumb },
  { path: '/something-else', breadcrumb: ':)' },
];

we could have, by default, a text transformation over the chunks of the URL.

users > Users something-else > Something Else something-with-even-more-hyphens > Something with even more hyphens

This would be an incremental upgrade: you can still pass the routes param to the HOC to set custom breadcrumbs on a per-route basis.

To achieve this string-humanization-by-default I suggest using https://github.com/sindresorhus/humanize-string.

Let me know if you think this is a good idea, I’m more than willing to submit a PR if that’s the case.

Thanks for your work.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
icd2k3commented, Mar 8, 2018

FYI this is now included as part of 2.0.0 along with some other core changes listed here

1reaction
icd2k3commented, Feb 22, 2018

Hey @nachoaIvarez, thanks for the suggestion! At initial glance I think it sounds like a good improvement idea!

One concern: Users might not want to render a breadcrumb from some route segments. In this case we’d need some kind of opt-out option if each segment automatically returns a default string.

I should have some time within the next couple weeks to try this idea on my end. In the meantime I’d be happy to take a look at a PR as well!

Read more comments on GitHub >

github_iconTop Results From Across the Web

better-defaults - MELPA
The largest and most up-to-date repository of Emacs packages.
Read more >
~technomancy/better-defaults - sourcehut git - sr.ht
#Better Defaults for Emacs. There are a number of unfortunate facts about the way Emacs works out of the box. While all users...
Read more >
Better Defaults layer - Spacemacs (develop)
This layer enhances the default commands of Emacs and is primarily intended to be used with the emacs editing style as it does...
Read more >
DavidBruant/better-defaults - GitHub
Better defaults · Someone creates software that works without too much attention to the details (because at the beginning perfect is the enemy...
Read more >
Even Better 'Better Defaults' : r/emacs - Reddit
r/emacs - Even Better 'Better Defaults' ... and (I don't know maybe not to some) are decently sane defaults for Org-Mode UI stuff....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found