elbe-ui 2.0.15 → 2.0.16

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.
@@ -8,7 +8,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
8
8
  });
9
9
  };
10
10
  import { jsx as _jsx } from "react/jsx-runtime";
11
- import { useEffect, useState } from "react";
11
+ import { useEffect, useRef, useState } from "react";
12
12
  import { Column, ErrorView, Spinner, } from "..";
13
13
  import { _isFn } from "./_bit_types";
14
14
  function _LoadView({}) {
@@ -16,7 +16,7 @@ function _LoadView({}) {
16
16
  }
17
17
  export function _makeBitProvider(context, bitP) {
18
18
  function _BitProvider(p) {
19
- const [streamCancel, setStreamCancel] = useState(null);
19
+ const streamCancelRef = useRef(null);
20
20
  const [state, setState] = useState({
21
21
  v: { type: "loading" },
22
22
  history: [],
@@ -81,10 +81,14 @@ export function _makeBitProvider(context, bitP) {
81
81
  try {
82
82
  if (!silent)
83
83
  _partCtrl.setLoading();
84
- if (streamCancel)
85
- streamCancel();
84
+ const prevCancel = streamCancelRef.current;
85
+ streamCancelRef.current = null;
86
+ if (prevCancel)
87
+ prevCancel();
86
88
  const cancel = _bit.stream(p, _partCtrl);
87
- setStreamCancel(() => cancel());
89
+ streamCancelRef.current = () => {
90
+ cancel();
91
+ };
88
92
  return;
89
93
  }
90
94
  catch (e) {
@@ -132,8 +136,10 @@ export function _makeBitProvider(context, bitP) {
132
136
  useEffect(() => {
133
137
  ctrl.reload(true);
134
138
  return () => {
135
- if (streamCancel)
136
- streamCancel();
139
+ const cancel = streamCancelRef.current;
140
+ streamCancelRef.current = null;
141
+ if (cancel)
142
+ cancel();
137
143
  // call dispose if exists
138
144
  const d = ctrl.dispose;
139
145
  if (typeof d !== "function")
@@ -44,7 +44,6 @@ export function WithTooltip(p) {
44
44
  var _a;
45
45
  timeoutRef.current = window.setTimeout(() => setVisible(true), (_a = p.delay) !== null && _a !== void 0 ? _a : 1000);
46
46
  }, onMouseLeave: () => {
47
- console.log("leave");
48
47
  if (timeoutRef.current) {
49
48
  clearTimeout(timeoutRef.current);
50
49
  timeoutRef.current = null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "elbe-ui",
3
- "version": "2.0.15",
3
+ "version": "2.0.16",
4
4
  "author": "Robin Naumann",
5
5
  "license": "MIT",
6
6
  "repository": {