Skip to content

Commit

Permalink
fix: options didn't update (#198)
Browse files Browse the repository at this point in the history
  • Loading branch information
Leioy authored Mar 28, 2024
1 parent 8a6a136 commit e894318
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/components/Select/Select.jsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from "react";
import PropTypes from "prop-types";
import classNames from "classnames";
import { get, isEmpty, isUndefined, isFunction } from "lodash";
import { get, isEmpty, isUndefined, isFunction, isEqual } from "lodash";

import Tag from "../Tag";
import Icon from "../Icon";
Expand Down Expand Up @@ -92,9 +92,12 @@ export default class Select extends React.Component {

componentDidUpdate(prevProps, prevState) {
const { value, options } = this.props;
const equal = isEqual(prevProps.options, options);
if (prevProps.options.length !== options.length) {
this.reachBottom = false;
this.setState({ options, options_copy: options });
} else if (!equal) {
this.setState({ options, options_copy: options });
}

if (!isUndefined(value) && value !== prevState.value) {
Expand Down

0 comments on commit e894318

Please sign in to comment.