dumi 2.3.0-alpha.3 → 2.3.0-alpha.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -26,9 +26,7 @@ if (typeof window !== 'undefined') {
26
26
  }
27
27
  export var useSiteSearch = function useSiteSearch() {
28
28
  var debounceTimer = useRef();
29
- // const routes = useLocaleDocRoutes();
30
- // const { demos } = useSiteData();
31
- var _useState = useState(false),
29
+ var _useState = useState(true),
32
30
  _useState2 = _slicedToArray(_useState, 2),
33
31
  loading = _useState2[0],
34
32
  setLoading = _useState2[1];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dumi",
3
- "version": "2.3.0-alpha.3",
3
+ "version": "2.3.0-alpha.4",
4
4
  "description": "📖 Documentation Generator of React Component",
5
5
  "keywords": [
6
6
  "generator",
@@ -88,6 +88,7 @@ var SearchBar = function SearchBar() {
88
88
  }), /*#__PURE__*/React.createElement(Input, {
89
89
  onFocus: function onFocus() {
90
90
  setFocusing(true);
91
+ loadSearchData();
91
92
  },
92
93
  onMouseEnter: function onMouseEnter() {
93
94
  loadSearchData();
@@ -98,6 +98,15 @@ var SearchResult = function SearchResult(props) {
98
98
  _useState4 = _slicedToArray(_useState3, 2),
99
99
  activeIndex = _useState4[0],
100
100
  setActiveIndex = _useState4[1];
101
+ var _useState5 = useState(props.loading),
102
+ _useState6 = _slicedToArray(_useState5, 2),
103
+ loading = _useState6[0],
104
+ setLoading = _useState6[1];
105
+ useEffect(function () {
106
+ if (!props.loading) {
107
+ setLoading(false);
108
+ }
109
+ }, [props.loading]);
101
110
  useEffect(function () {
102
111
  var handler = function handler(ev) {
103
112
  // TODO: scroll into view for invisible items
@@ -124,7 +133,7 @@ var SearchResult = function SearchResult(props) {
124
133
  };
125
134
  });
126
135
  var returnNode = null;
127
- if (props.loading) {
136
+ if (loading) {
128
137
  returnNode = /*#__PURE__*/React.createElement("div", {
129
138
  className: "dumi-default-search-empty"
130
139
  }, /*#__PURE__*/React.createElement(IconInbox, null), /*#__PURE__*/React.createElement(FormattedMessage, {