@leanmcp/ui 0.3.0 → 0.3.1

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.
package/dist/index.mjs CHANGED
@@ -1657,6 +1657,10 @@ function useResource(uri, options = {}) {
1657
1657
  fetchResource
1658
1658
  ]);
1659
1659
  useEffect(() => {
1660
+ if (intervalRef.current) {
1661
+ clearInterval(intervalRef.current);
1662
+ intervalRef.current = null;
1663
+ }
1660
1664
  if (refreshInterval && refreshInterval > 0 && isConnected && !skip) {
1661
1665
  intervalRef.current = setInterval(() => {
1662
1666
  fetchResource().catch(() => {
@@ -2587,7 +2591,10 @@ function useToolSubscription(toolName, options = {}) {
2587
2591
  setIsPolling(false);
2588
2592
  }, []);
2589
2593
  const start = useCallback(() => {
2590
- stop();
2594
+ if (intervalRef.current) {
2595
+ clearInterval(intervalRef.current);
2596
+ intervalRef.current = null;
2597
+ }
2591
2598
  setIsPolling(true);
2592
2599
  toolHook.call(args).catch(() => {
2593
2600
  });
@@ -2598,8 +2605,7 @@ function useToolSubscription(toolName, options = {}) {
2598
2605
  }, [
2599
2606
  toolHook.call,
2600
2607
  args,
2601
- interval,
2602
- stop
2608
+ interval
2603
2609
  ]);
2604
2610
  const refresh = useCallback(async () => {
2605
2611
  return toolHook.call(args);