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

TagBuilder is really slow in controlled mode. #171

Open
5 tasks done
guiherzog opened this issue Sep 13, 2019 · 3 comments
Open
5 tasks done

TagBuilder is really slow in controlled mode. #171

guiherzog opened this issue Sep 13, 2019 · 3 comments

Comments

@guiherzog
Copy link
Contributor

guiherzog commented Sep 13, 2019

Bug Report

Prerequisites

  • Can you reproduce the problem in a MWE?
  • Are you running the latest version?
  • Did you check the FAQs to see if that helps you?
  • Are you reporting to the correct repository?
  • Did you perform a search in the issues?

For more information, see the CONTRIBUTING guide.

Versions

Version 0.8.1

Description

Using TagBuilder in controlled mode, makes it really slow to react to user typing.

Steps to Reproduce

  1. Create a TagBuilder component on KitchenSink.
  2. Change it to be use in controlled mode.
  3. Try type something fast.

Expected behavior:
It would show the input a soon as I type.

Actual behavior:
It slugs to show the char I just pressed.

Environment details:

Tested on macOS Mojave 10.14.6
And Chrome Version 76.0.3809.132

@ZEISSLaurinAgostini
Copy link
Contributor

I'm not sure if I understand this correctly but in controlled mode, you shouldn't be able to type something.
In fact, you can't do it as you may test on the second example at https://precise-ui.io/#/Components/TagBuilder.

@guiherzog
Copy link
Contributor Author

Yes, you should. The only difference would be that the state (value) of the component would be controlled by its parent. Then, after I type something, a onChange call should be triggered and I can change the state of the component on its parent.

All other components behave normally when using in controlled mode. But this one lags a lot when typing anything and changing the state.

@Saladinek
Copy link
Contributor

Saladinek commented Jan 20, 2020

I am unable to reproduce laggy behaviour of TagBuilder described in the issue. Code used in0 KitchenSink:

const { TagBuilder, Button } = require('precise-ui');

const MyTagBuilder = () => {

const [input, setInput] = React.useState('');
const [value, setValue] = React.useState([]);

const onInputChange = ({ value }) => {
setInput(value);
};

const addValue = (input) => {
setValue([...value, input]);
setInput('');
};

const deleteValue = ({ value }) => {
setValue(value)
};

return (
	<>
    	<TagBuilder value={value} inputValue={input} onInput={onInputChange} onChange={deleteValue} />
        <Button onClick={() => addValue(input)} >Add</Button>
    </>
 )

}

Perhaps the issue has been fixed in the progress already?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants