@ohhwells/bridge 0.1.132-next.358 → 0.1.132-next.360

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.cjs CHANGED
@@ -4187,18 +4187,25 @@ function FadeSlideshow({ node, ctx, path }) {
4187
4187
  (dir) => onInteract(stepViableSlide(index, failed, count, dir, loop)),
4188
4188
  [count, failed, index, loop, onInteract]
4189
4189
  );
4190
+ const prefetchRef = import_react.default.useRef(prefetch);
4191
+ import_react.default.useEffect(() => {
4192
+ prefetchRef.current = prefetch;
4193
+ });
4194
+ import_react.default.useEffect(() => {
4195
+ if (autoplay) hasInteractedRef.current = false;
4196
+ }, [autoplay]);
4190
4197
  import_react.default.useEffect(() => {
4191
4198
  if (!autoplay) return;
4192
4199
  const id = window.setInterval(() => {
4193
4200
  if (hasInteractedRef.current || hoveredRef.current) return;
4194
4201
  setIndex((i) => loop ? (i + 1) % count : Math.min(count - 1, i + 1));
4195
4202
  }, intervalMs);
4196
- const warmId = window.setTimeout(() => prefetch(1 % count), Math.min(1500, intervalMs / 2));
4203
+ const warmId = window.setTimeout(() => prefetchRef.current(1 % count), Math.min(1500, intervalMs / 2));
4197
4204
  return () => {
4198
4205
  window.clearInterval(id);
4199
4206
  window.clearTimeout(warmId);
4200
4207
  };
4201
- }, [autoplay, count, intervalMs, loop, prefetch]);
4208
+ }, [autoplay, count, intervalMs, loop]);
4202
4209
  const hasMovedRef = import_react.default.useRef(false);
4203
4210
  import_react.default.useEffect(() => {
4204
4211
  if (!hasMovedRef.current) {