Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(react-tooltip): use useIsomorphicLayoutEffect to avoid SSR warnings #17894

Merged
merged 17 commits into from
Apr 22, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
disable lint for valid usages
  • Loading branch information
layershifter committed Apr 21, 2021
commit 66760fb6eb17437f3a0c2a260a4c1b0b3fe9610c
1 change: 1 addition & 0 deletions packages/react/src/components/Image/Image.base.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ function useLoadState(

const [loadState, setLoadState] = React.useState<ImageLoadState>(ImageLoadState.notLoaded);

// eslint-disable-next-line no-restricted-properties
React.useLayoutEffect(() => {
// If the src property changes, reset the load state
// (does nothing if the load state is already notLoaded)
Expand Down
2 changes: 2 additions & 0 deletions packages/react/src/components/KeytipData/useKeytipData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ export function useKeytipData(options: KeytipDataOptions): IKeytipData {
const prevOptions = usePrevious(options);

// useLayoutEffect used to strictly emulate didUpdate/didMount behavior
// eslint-disable-next-line no-restricted-properties
React.useLayoutEffect(() => {
if (
uniqueId.current &&
Expand All @@ -36,6 +37,7 @@ export function useKeytipData(options: KeytipDataOptions): IKeytipData {
}
});

// eslint-disable-next-line no-restricted-properties
React.useLayoutEffect(() => {
// Register Keytip in KeytipManager
if (keytipProps) {
Expand Down
1 change: 1 addition & 0 deletions packages/react/src/components/Layer/Layer.base.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ export const LayerBase: React.FunctionComponent<ILayerProps> = React.forwardRef<
onLayerDidMount?.();
};

// eslint-disable-next-line no-restricted-properties
React.useLayoutEffect(() => {
createLayerElement();
// Check if the user provided a hostId prop and register the layer with the ID.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -344,6 +344,7 @@ export const MaskedTextField: React.FunctionComponent<IMaskedTextFieldProps> = R
}, [mask, value]);

// Run before browser paint to avoid flickering from selection reset.
// eslint-disable-next-line no-restricted-properties
React.useLayoutEffect(() => {
// Move the cursor to position before paint.
if (maskCursorPosition !== undefined && textField.current) {
Expand Down
1 change: 1 addition & 0 deletions packages/react/src/utilities/useOverflow.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ export const useOverflow = ({ onOverflowItemsChanged, rtl, pinnedIndex }: Overfl
return () => containerRef(null);
});

// eslint-disable-next-line no-restricted-properties
React.useLayoutEffect(() => {
const container = containerRef.current;
const menuButton = menuButtonRef.current;
Expand Down