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 issue with numAddedLinks state in Smart Linking component #2400

Closed
vaurdan opened this issue Apr 18, 2024 · 1 comment · Fixed by #2507
Closed

Fix issue with numAddedLinks state in Smart Linking component #2400

vaurdan opened this issue Apr 18, 2024 · 1 comment · Fixed by #2507
Milestone

Comments

@vaurdan
Copy link
Contributor

vaurdan commented Apr 18, 2024

Describe the bug

The numAddedLinks state does not update correctly after smart links are applied, remaining at 0 despite the function being called with the correct value. This makes the number shown in the component notice sometimes different from the one shown in the snackbar message, since the notice fallback to the number of suggested smart links when numAddedLinks is zero.

To Reproduce

Steps to reproduce the behavior:

  1. Go to the Smart Linking section
  2. Click on the button to generate and apply smart links
  3. In some scenarios, when there are suggestions that can't be applied, the number of smart links applied shown in the notice will be different from the number of actually applied smart links, and different from the value reported in the Snackbar (that is correct).

Expected behavior

The numAddedLinks state should update to reflect the correct number of smart links applied to the content.

Additional context

The numAddedLinks state updating issue appears to involve asynchronous state updates, where the function setNumAddedLinks is being called with the correct values but does not reflect these changes in the UI. This may be due to asynchronous operations or side effects within the component that reset or interfere with the state before it can update the UI.

There could be potential race conditions where multiple state updates occur in rapid succession or interference from other components or state management logic. Investigating the sequence and handling of state updates in conjunction with component lifecycle events might provide further insights into the issue.

@acicovic
Copy link
Collaborator

Bumping this to the 3.16.0 milestone since it should be fixed in #2507.

@acicovic acicovic modified the milestones: 3.15.1, 3.16.0 May 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants