docusaurus icon indicating copy to clipboard operation
docusaurus copied to clipboard

@algolia autocomplete-shared throws a warning regarding 'render' option

Open jkohlin opened this issue 3 years ago • 2 comments
trafficstars

Have you read the Contributing Guidelines on issues?

Prerequisites

  • [X] I'm using the latest version of Docusaurus.
  • [X] I have tried the npm run clear or yarn clear command.
  • [X] I have tried rm -rf node_modules yarn.lock package-lock.json and 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

  1. Install Docusaurus v.2 npx create-docusaurus@latest my-website classic on node 16
  2. Install plugin @cmfcmf/docusaurus-search-local
  3. add it to docusaurus.config.js
…
  plugins: [
    [
      require.resolve("@cmfcmf/docusaurus-search-local"),
      {
        language: "sv",
        indexPages: true,
      },
    ],
],
…
  1. 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 render option only to override Autocomplete's default render function, pass the render function into renderer and remove the render option.
  • If you are using the render option to customize the layout, pass your render function into renderer and use it from the provided parameters of the render option.
  • If you are using the render option to work with React 18, pass an empty render function into renderer. 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.

jkohlin avatar Oct 05 '22 09:10 jkohlin

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)

slorber avatar Oct 05 '22 10:10 slorber

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

slorber avatar Oct 05 '22 10:10 slorber

Thanks for letting me know! This is now fixed in the latest version of the plugin.

cmfcmf avatar Feb 26 '23 09:02 cmfcmf

Thanks, let's close then ;)

slorber avatar Mar 02 '23 12:03 slorber