Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import type { IMessage } from '@rocket.chat/core-typings';
import { useSafeRefCallback } from '@rocket.chat/ui-client';
import { useRouter } from '@rocket.chat/ui-contexts';
import { useCallback } from 'react';

import { useMessageListJumpToMessageParam, useMessageListRef } from '../../../../components/message/list/MessageListContext';
import { useSafeRefCallback } from '../../../../hooks/useSafeRefCallback';
import { setHighlightMessage, clearHighlightMessage } from '../providers/messageHighlightSubscription';

// this is an arbitrary value so that there's a gap between the header and the message;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { useMergedRefs } from '@rocket.chat/fuselage-hooks';
import { useSafeRefCallback } from '@rocket.chat/ui-client';
import type { MutableRefObject } from 'react';
import { useCallback, useRef } from 'react';

import { isAtBottom as isAtBottomLib } from '../../../../../app/ui/client/views/app/lib/scrolling';
import { withThrottling } from '../../../../../lib/utils/highOrderFunctions';
import { useSafeRefCallback } from '../../../../hooks/useSafeRefCallback';

export const useListIsAtBottom = () => {
const atBottomRef = useRef(true);
Comment thread
gabriellsh marked this conversation as resolved.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/* eslint-disable complexity */
import type { IMessage, ISubscription } from '@rocket.chat/core-typings';
import { useContentBoxSize, useEffectEvent } from '@rocket.chat/fuselage-hooks';
import { useSafeRefCallback } from '@rocket.chat/ui-client';
Comment thread
gabriellsh marked this conversation as resolved.
import {
MessageComposerAction,
MessageComposerToolbarActions,
Expand Down Expand Up @@ -43,7 +44,6 @@ import { useEnablePopupPreview } from '../hooks/useEnablePopupPreview';
import { useMessageComposerMergedRefs } from '../hooks/useMessageComposerMergedRefs';
import { useMessageBoxAutoFocus } from './hooks/useMessageBoxAutoFocus';
import { useMessageBoxPlaceholder } from './hooks/useMessageBoxPlaceholder';
import { useSafeRefCallback } from '../../../../hooks/useSafeRefCallback';

const reducer = (_: unknown, event: FormEvent<HTMLInputElement>): boolean => {
const target = event.target as HTMLInputElement;
Expand Down
3 changes: 1 addition & 2 deletions apps/meteor/client/views/room/hooks/useIsVisible.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import { useDebouncedState, useSafely } from '@rocket.chat/fuselage-hooks';
import { useSafeRefCallback } from '@rocket.chat/ui-client';
import { useCallback } from 'react';

import { useSafeRefCallback } from '../../../hooks/useSafeRefCallback';

export const useIsVisible = () => {
const [menuVisibility, setMenuVisibility] = useSafely(useDebouncedState(!!window.DISABLE_ANIMATION, 100));

Expand Down
1 change: 1 addition & 0 deletions packages/ui-client/src/hooks/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ export * from './usePreferenceFeaturePreviewList';
export * from './useDocumentTitle';
export * from './useUserDisplayName';
export * from './useValidatePassword';
export * from './useSafeRefCallback';
1 change: 1 addition & 0 deletions packages/ui-client/src/hooks/useSafeRefCallback/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './useSafeRefCallback';
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,6 @@ import { render } from '@testing-library/react';

import { useSafeRefCallback } from './useSafeRefCallback';

// const TestComponent = (callback: () => () => void) => {
// const cbRef = useSafeRefCallback(callback);

// return <div ref={cbRef}></div>;
// };

const TestComponent = ({ callback, renderSpan }: { callback: any; renderSpan?: boolean }) => {
const cbRef = useSafeRefCallback(callback);

Expand Down