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.

Code breaks after upgrading from v3.4.6 to v6.0.0

See original GitHub issue

when upgrading from v3.4.6 to v6.0.0, my javascript code breaks

TypeError: Cannot read property ‘map’ of undefined

I’ve tracked down that the fuse.search() is returning undefined after upgrading, when before the upgrade.

import Fuse from 'fuse.js'

export default function filterRecipeList(searchValue, recipesToSearch) {
  var options = {
    shouldSort: true,
    tokenize: true,
    threshold: 0.3,
    location: 0,
    distance: 100,
    maxPatternLength: 32,
    minMatchCharLength: 1,
    keys: ['id', 'name', 'ingredients.name']
  }

  console.log(recipesToSearch)
  console.log('handleRecipeSearch options: ' + options)
  
  var fuse = new Fuse(recipesToSearch, options) // "list" is the item array
  console.log('handleRecipeSearch searchValue: ' + searchValue)
  
  var result = fuse.search(searchValue)
  console.log('handleRecipeSearch result: ' + result)

  return result
}

Any Ideas? Does it have anything to do with my node.js version?

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:8 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
jazoomcommented, Jun 6, 2020

Okay, I figured it out. The search results are now wrapping each item in an object under key item. So to get it to work as before you need to do something like `results = results.map(i => i.item);

This is actually mentioned in the changelog, without saying what was actually changed about the search results. The trick here is apparently this library doesn’t show breaking changes in major version updates, but in each of the beta updates, so you need to read through all of the many beta updates to pick up on breaking changes.

0reactions
kriskcommented, Jun 22, 2020

Yes. This is my bad. I failed to update the changelog. Will be more disciplined moving forward.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Upgrade Windows Forms apps to .NET 6 - Microsoft Learn
In this article. Demo app; Analyze your app; Run upgrade-assistant; Visual Basic projects; After upgrading; Troubleshooting tips; See also.
Read more >
Upgrading from ADF v5.0 to v6.0 - Alfresco Builder Network
The ADF project follows the semver conventions and so we only make breaking changes (ie, not backward-compatible) in major versions. ADF 6.0 is...
Read more >
Releases - styled-components
Updating styled components is usually as simple as npm install . Only major versions have the potential to introduce breaking changes (noted in...
Read more >
FortiOS Release Notes | FortiGate / FortiOS 6.4.9
DNS filter forwards the DNS status code 1 FormErr as status code 2 ServFail in ... proxy and SSL deep inspection stops working...
Read more >
MUI Versions
These releases include breaking changes. When updating to a new major release, you may need to run update scripts, refactor code, run additional...
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