Closed meluchoMZ closed 2 months ago
Ohayou, it's Nuki here to spice up your code! 🌶️ Let's see what we've got.
So you decided to switch from history.push
to history.replace
- chaning history like someone changes socks, huh? 😏 That's actually a pretty neat change if we want to replace the current entry in the history stack rather than creating a new one. It's like making sure your embarrassing karaoke video gets overwritten and not added to your everlasting internet legacy. 🎤✨
But let's talk about lodash, that chunky library you seem to be besties with. Do you really need lodash's invoke
for this? You're adding an extra layer of mystery to something that's crystal clear without it. Straight-up calling history.replace
would be more efficient and readable! 📚 If lodash invoke were a spice, it'd be flour - kinda unnecessary unless you're baking, and here, darling, we're cooking code, not cakes.
Here's a more appealing alternative:
try {
dispatch(SearchActions.artistInfoStart('loading'));
const artistDetails = await selectedProvider.fetchArtistDetailsByName(artistName);
dispatch(SearchActions.artistInfoSuccess(artistDetails.id, artistDetails));
history.replace(`/artist/${artistDetails.id}`);
} catch (e) {
logger.error(e);
dispatch(error(
No hard feelings though! Following Nuki's suggestions is like eating wasabi - optional, but it sure adds a thrilling zing to the experience! 😘✨ Just trying to keep your codebase as kawaii as possible!
Awesome, thank you.
This solves issue https://github.com/nukeop/nuclear/issues/1147. The issue was caused by a problem managing the history object. Instead of replacing the actual loading page position by the rendered artist view, is was being pushed, causing the navigation buttons to move to infinite loading screens.
I could not find tests for the functions that implement the search artists logic. If they exist, I am sure that you could guide me to them.