Skip to content

Instantly share code, notes, and snippets.

@johnpc
Last active June 20, 2019 20:04
Show Gist options
  • Save johnpc/3032817275224913b3f1cfab17b18748 to your computer and use it in GitHub Desktop.
Save johnpc/3032817275224913b3f1cfab17b18748 to your computer and use it in GitHub Desktop.
Antd Cascader bug
// Reproduce with the following steps:
// 1. npx create-react-app antd-bug
// 2. cd antd-bug
// 3. npm install antd && yarn add antd
// 4. copy this code into into src/index.js
// 5. npm start
// Navigate to localhost:3000
// Use the search box to search for "option". Use backspace and re-type. You will see lines get duplicated.
// Screen capture video available here: https://www.youtube.com/watch?v=bc9fT4T87ek
// Gif version available here: https://jpc.io/r/antd-bug.gif
import React from 'react';
import ReactDOM from 'react-dom';
import './index.css';
import { Cascader } from "antd";
ReactDOM.render(
<Cascader
showSearch
placeholder="Testing"
onChange={function() {
return null;
}}
options={[
{
label: "Option 1",
children: [{ label: "Option 1.1", children: [] }]
},
{
label: "Option 2",
children: [
{ label: "Option 2.1", children: [] },
{ label: "Option 2.2", children: [] }
]
},
{ label: "Option 3", children: [] }
]}
/>,
document.getElementById("root")
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment