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

When I add the dropdownsConfig property to the Cron component, it starts to re-render and goes into an infinite loop #67

Open
nesathanozturk opened this issue May 7, 2024 · 2 comments
Labels
bug Something isn't working PR welcome You can open a PR for this issue

Comments

@nesathanozturk
Copy link

Describe the bug
When I add the dropdownsConfig property to the Cron component, it starts to re-render and goes into an infinite loop.

To Reproduce
Steps to reproduce the behavior:

  1. Add dropdownsConfig property to Cron component.
  2. Choose month and select any value at "every day of the month" dropdown. Also add a console.log into your component.
  3. When selected a value, it starts to re-render.
  4. You can see the infinite console.log loop in your browser.

Expected behavior
When I add the dropdownsConfig property to the Cron component, it shouldn't go into an infinite loop.

Screenshots

ss2 ss1

Versions (please complete the following information):

  • react-js-cron version 5.0.1
  • React version: 18.2.0
  • OS: MacOS
  • Browser: Firefox
@xrutayisire xrutayisire added bug Something isn't working PR welcome You can open a PR for this issue labels May 8, 2024
@xrutayisire
Copy link
Owner

Hi,

I don't know how nobody reported this. I definitely think there is a bug on this particular prop.
I don't have time right now to fix it. If you can debug and create a PR it's perfect 🙌

In the meantime, I recommend everyone, not to use this prop until a fix is made.

@nesathanozturk
Copy link
Author

@xrutayisire Hi again. I added the following control into the setValue function and it fixed the re-render problem. Now, i can use the dropdrownsConfig property with setValue function. Maybe it might be useful for you to solve this problem.

  setValue={(newValue: string) => {
     if (newValue !== values.cronValue) {
                dispatchValues({
                    type: 'set_values',
                    value: newValue,
                })
                handleCronChange(newValue)
            }
    }}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working PR welcome You can open a PR for this issue
Projects
None yet
Development

No branches or pull requests

2 participants