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

Significant performance drop on Draft.js and RHF 6.13.1 #3785

Closed
veekungx opened this issue Dec 27, 2020 · 3 comments
Closed

Significant performance drop on Draft.js and RHF 6.13.1 #3785

veekungx opened this issue Dec 27, 2020 · 3 comments
Labels
bug Something isn't working

Comments

@veekungx
Copy link

veekungx commented Dec 27, 2020

Describe the bug
When integrate with draft.js and RHF 6.13.X. After input a lot of text it start to drop some performance.
This issue not happed in RHF 6.12.X

To Reproduce

import React from 'react';
import { Controller, useForm } from "react-hook-form";
import { Editor, EditorState } from "draft-js";

function App() {
  const { control } = useForm({
    defaultValues: {
      draft: EditorState.createEmpty(),
    },
  });

  return (
    <div>
      <form>
        <Controller
          name="draft"
          control={control}
          render={({ value, onChange }) => {
            return <Editor editorState={value} onChange={onChange} />;
          }}
        />
      </form>
    </div>
  );
}

GIF
2563-12-27-19.03.04.gif

Codesandbox link (Required)

Expected behavior

Desktop (please complete the following information):

  • OS: macOS(Big Sur)
  • Browser: Chrome
  • Version: 87.0.4280.88
@bluebill1049 bluebill1049 added the status: under investigation aware of this issue and pending for investigation label Dec 27, 2020
@bluebill1049
Copy link
Member

can you provide more information and detail? perhaps perf measurement and see if it's worth it for us to spend time on fixing this.

@veekungx
Copy link
Author

@bluebill1049 I provide some gif for you.

RHF 6.12 & 6.13

When typing a lot of text or pasted. 6.13 start to jumpy and hang.

@bluebill1049 bluebill1049 added bug Something isn't working and removed status: under investigation aware of this issue and pending for investigation labels Dec 28, 2020
@bluebill1049
Copy link
Member

we will use shallow clone instead of deep clone for object value.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 13, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants