Skip to content

react-simplikit@0.4.2

Latest

Choose a tag to compare

@github-actions github-actions released this 26 Nov 05:53
7f6b0ac

Patch Changes

  • #605 6a916fc Thanks @KooYS! - disableBodyScrollLock (and so useBodyScrollLock on unmount) now returns the page to the state it was in before the lock. It puts back the inline overflow, position, top, left, right and bottom styles the body had, including !important, instead of removing them; a property that other code changed while the body was locked is left as it is. It also jumps back to the saved scroll position with behavior: 'instant'; before, when the root element (html) had scroll-behavior: smooth, the page jumped to the top and animated back to that position.

  • #592 1ead5b0 Thanks @Choi-Jung-Hyeon! - useList, useSet and useMap no longer serialize initialState with JSON.stringify on every render. Before, they threw on the first render when the initial values held a BigInt or a circular object. reset now always uses the latest initialState; for useSet and useMap it used to keep the first Set or Map it was given.

  • #615 515b10e Thanks @h00ns! - useOutsideClickEffect no longer calls the callback for the click that rendered its container. React runs the effects of a click's update before that click reaches document, so a popup opened by a button outside it closed again on the same click. Whenever a new container element appears, including on the first render, clicks are now ignored until a setTimeout(0) fires. A test that clicks outside right after rendering needs to wait for that timer first, for example with await act(() => new Promise(resolve => setTimeout(resolve, 0))), or vi.advanceTimersByTime(0) with fake timers.

  • #602 5fa5149 Thanks @JeongHwan-dev! - subscribeKeyboardHeight now delivers the latest keyboard height once the throttle window ends. Before, events that fired while a window was open were dropped, so a keyboard animation that finished inside the window left the callback at an intermediate height.

  • #591 8c56151 Thanks @Choi-Jung-Hyeon! - SwitchCase now only matches keys defined on caseBy itself. Before, a value such as 'toString' or 'constructor' matched a method inherited from Object.prototype, so the component rendered [object Undefined] or threw instead of rendering defaultComponent.

  • #594 ac96b38 Thanks @Choi-Jung-Hyeon! - useGeolocation no longer leaves loading stuck at true when stopTracking() is called before the first position arrives. A watch started with startTracking() also keeps running when a position option such as enableHighAccuracy changes. Before, the watch was cleared without being restarted while isTracking stayed true.

  • #603 a07827f Thanks @JeongHwan-dev! - useIntersectionObserver now passes the latest entry of a batch to the callback. Before, it read only the first entry, so when an element entered and left the viewport within one observer tick the callback received the stale "entered" entry and missed the exit.

  • #598 cd66595 Thanks @Choi-Jung-Hyeon! - useScrollDirection re-checks window.scrollY when the throttle timer ends. Before, a scroll that stopped inside the throttle window left position stale.

  • #596 d48b1eb Thanks @Choi-Jung-Hyeon! - useStorageState's refreshState no longer writes to storage. Before, it wrote the current snapshot back, so calling it on an empty key persisted defaultValue.