docusaurus
docusaurus copied to clipboard
@algolia autocomplete-shared throws a warning regarding 'render' option
Have you read the Contributing Guidelines on issues?
- [X] I have read the Contributing Guidelines on issues.
Prerequisites
- [X] I'm using the latest version of Docusaurus.
- [X] I have tried the
npm run clearoryarn clearcommand. - [X] I have tried
rm -rf node_modules yarn.lock package-lock.jsonand re-installing packages. - [X] I have tried creating a repro with https://new.docusaurus.io.
- [X] I have read the console error message carefully (if applicable).
Description
I get this warning in the browser console. I don't even use algolia so I don't understand how to fix this. I'm using the local search plugin recommended in the docs
It's reproducible in the sandbox below.
Reproducible demo
https://codesandbox.io/s/gallant-sara-ietpq9?file=/package.json
Steps to reproduce
- Install Docusaurus v.2
npx create-docusaurus@latest my-website classicon node 16 - Install plugin @cmfcmf/docusaurus-search-local
- add it to
docusaurus.config.js
…
plugins: [
[
require.resolve("@cmfcmf/docusaurus-search-local"),
{
language: "sv",
indexPages: true,
},
],
],
…
- run
npm run start
Expected behavior
No warnings
Actual behavior
[Autocomplete] You provided the render option but did not provide a renderer.render. Since v1.6.0, you can provide a render function directly in renderer.
To get rid of this warning, do any of the following depending on your use case.
- If you are using the
renderoption only to override Autocomplete's defaultrenderfunction, pass therenderfunction intorendererand remove therenderoption. - If you are using the
renderoption to customize the layout, pass yourrenderfunction intorendererand use it from the provided parameters of therenderoption. - If you are using the
renderoption to work with React 18, pass an emptyrenderfunction intorenderer. See https://www.algolia.com/doc/ui-libraries/autocomplete/api-reference/autocomplete-js/autocomplete/#param-render
Your environment
- Public source code:
- Public site URL:
- Docusaurus version used: 2
- Environment name and version (e.g. Chrome 89, Node.js 16.4): Arc Version 0.70.0 (34916) , Chromium Engine Version 106.0.5249.62, Node 16.14.0
- Operating system and version (e.g. Ubuntu 20.04.2 LTS): alpine3.14 (docker-container)
- Dockerfile:
FROM node:16.14.0-alpine3.14
RUN mkdir -p /opt/app && apk add --no-cache libc6-compat
ENV NODE_ENV development
WORKDIR /opt/app
COPY ./package*.json .
#COPY ./.npmrc .
RUN npm install
COPY . /opt/app
#RUN npm instal´
EXPOSE 3000
CMD [ "npm", "run", "start" ]
Self-service
- [ ] I'd be willing to fix this bug myself.
cc @shortcuts : that warning seems unexpected 🤔
On that repro the Algolia plugin is not even loaded (can be seen on https://ietpq9.sse.codesandbox.io/__docusaurus/debug/metadata)
Oh, just saw that the local search plugin has it as a dependency 😅 I don't know why
Can you explain @cmfcmf ? Looks like it's a bug in your plugin, not Docusaurus
https://github.com/cmfcmf/docusaurus-search-local/blob/main/packages/docusaurus-search-local/package.json#L26
Thanks for letting me know! This is now fixed in the latest version of the plugin.
Thanks, let's close then ;)