Skip to content

Commit

Permalink
SSR support fixes [prerelease]
Browse files Browse the repository at this point in the history
  • Loading branch information
MosheZemah committed Oct 6, 2024
1 parent f4fa84e commit 0f16492
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion packages/core/src/components/Dropdown/__tests__/driver.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export default class DropdownDriver {
this.renderResult = render(<Dropdown {...this.props} />);

// If there's asynchronous logic in useEffect, we can await it here
await new Promise(resolve => setTimeout(resolve, 100)); // Adjust timeout based on the async logic
await new Promise(resolve => setTimeout(resolve, 0)); // Adjust timeout based on the async logic
});
return this.renderResult;
}
Expand Down
5 changes: 3 additions & 2 deletions packages/core/src/components/EditableInput/EditableInput.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import cx from "classnames";
import React, { forwardRef, useCallback, useEffect, useLayoutEffect, useRef, useState } from "react";
import React, { forwardRef, useCallback, useEffect, useRef, useState } from "react";
import autosize from "autosize";
import useStyle from "../../hooks/useStyle";
import useMergeRef from "../../hooks/useMergeRef";
import useIsomorphicLayoutEffect from "../../hooks/ssr/useIsomorphicLayoutEffect";
import {
isArrowDownEvent,
isArrowLeftEvent,
Expand Down Expand Up @@ -213,7 +214,7 @@ const EditableInput: VibeComponent<EditableInputProps> & {
// Callbacks END

// Effects
useLayoutEffect(() => {
useIsomorphicLayoutEffect(() => {
if (shouldFocusOnMount) focus();
autosizeIfNeeded();
selectOnMount ? select() : moveCaretAtEnd();
Expand Down

0 comments on commit 0f16492

Please sign in to comment.