- Consolidated duplicate UndoManagers to single instance - Fixed connection promise to only resolve on 'connected' status - Fixed WebSocketProvider import (WebsocketProvider) - Added proper doc.destroy() cleanup - Renamed isPresenceInitialized property to avoid conflict Co-Authored-By: Paperclip <noreply@paperclip.ing>
13 lines
315 B
JavaScript
13 lines
315 B
JavaScript
import React from 'react';
|
|
import { shallow } from 'zustand/vanilla/shallow';
|
|
|
|
function useShallow(selector) {
|
|
const prev = React.useRef(undefined);
|
|
return (state) => {
|
|
const next = selector(state);
|
|
return shallow(prev.current, next) ? prev.current : prev.current = next;
|
|
};
|
|
}
|
|
|
|
export { useShallow };
|