react-algoliasearch icon indicating copy to clipboard operation
react-algoliasearch copied to clipboard

Unable to override templates

Open nhunzaker opened this issue 7 years ago • 2 comments

It looks like this package uses deep-assign under the hood, which does not merge in function values:

var deepAssign = require("deep-assign")

deepAssign({ templates: { suggestion: true } }, { templates: { suggestion: () => {} } })

via https://npm.runkit.com/deep-assign

This makes it impossible to change the suggestion template which is used to control the display text of suggestions during autocomplete:

let options = {
  templates: {
    suggestion: entry => entry.name
  }
}

<AgAutocomplete options={options} />

Additionally, deep-assign has been deprecated, and the author recommends using something like merge-options.

nhunzaker avatar Jan 04 '18 16:01 nhunzaker

thanks @nhunzaker this weekend i'll take care to update this stuff and publish to npm with the other fixes

scerelli avatar Jan 09 '18 16:01 scerelli

Thanks! I ended up temporarily vendoring your package. This is the deep assign package I pulled in: https://github.com/KyleAMathews/deepmerge

nhunzaker avatar Jan 09 '18 21:01 nhunzaker