chrisblakley / Nebula

Nebula is a WordPress theme framework that focuses on enhancing development. The core features of Nebula make it a powerful tool for designing, developing, and analyzing WordPress websites consistently, yet its deliberately uncomplicated code syntax also serves as a learning resource for programmers themselves.
https://nebula.gearside.com
GNU General Public License v2.0
139 stars 36 forks source link

Nebula Options Search not returning refined results #2264

Closed terencehoverter closed 9 months ago

terencehoverter commented 9 months ago

Version information can be found in the lower right of most WP admin screens WordPress Version: WordPress 6.3.1 Nebula Version: Nebula 11.4.21.615

Describe the Problem Searching for an option in the Nebula Options does not return refined results, all options are returned instead (because of an error)

Steps to Reproduce

  1. Go to... Nebula Options
  2. Click in... Search and type an option like "Sass"
  3. See results are disappointingly every nebula option to exist
  4. See error in the console suggesting regex is not defined in search.js on line 51

Expected Behavior TO BE ABLE TO SEARCH AN OPTION IN THE NEBULA OPTIONS.

Screenshots image image image

Environment Details Windows custom built PC aka Disco-Volante running Windows 10, Latest version of Chrome

Additional Information I have been developing all day and this was the quickest I was able to fill out a bug report

chrisblakley commented 9 months ago

Thanks Terry– I'll get this taken care of.

chrisblakley commented 9 months ago

The solution here was to change the let to var inside the try/catch a few lines up from where the error was occurring:

try {
    var regex = new RegExp(value, 'i'); //Keep var here so variable can be used outside of the try/catch without erroring
} catch(error){ //This is an invalid RegEx pattern
    return false; //Ignore this search
}

This will be pushed to Nebula, but this should also be an easy retrofit if needing to fix without updating the entire Nebula theme.

Edit: Remember, if manually updating to clear caches and/or manually bump up the version number. Because search.js is a module, the browser may cache it even if you try to clear caches via Nebula.