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

Add all missing dependencies to Rasa Playground onLiveCodeChange callback function #8109

Merged
merged 3 commits into from
Mar 4, 2021

Conversation

alwx
Copy link
Contributor

@alwx alwx commented Mar 4, 2021

Proposed changes:

Status (please check what you already did):

  • added some tests for the functionality
  • updated the documentation
  • updated the changelog (please check changelog for instructions)
  • reformat files using black (please check Readme for instructions)

@alwx alwx requested review from gausie and mjaycub March 4, 2021 12:11
@alwx alwx marked this pull request as ready for review March 4, 2021 12:11
Copy link
Contributor

@gausie gausie left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is a slight change you can make here to reduce dependencies and thus reduce redefinitions of onLiveCodeChange and thus reduce rerenders. I would do it (I think! I haven't tested this) but it's up to you.

if (chatState === "ready") {
      clearPollingInterval();
      setChatState("needs_to_be_retrained");
      updateChatBlock();
    }

can be changed to something like

setChatState(cs => {
  if (cs !== "ready") return cs;
  clearPollingInterval();
  updateChatBlock();
  return "needs_to_be_retrained";
});

If updateChatBlock needs to change after chatState changes, you can do it in an effect.

The same as the above goes for hasStarted.

@alwx
Copy link
Contributor Author

alwx commented Mar 4, 2021

To be fair, I think a big bunch of what's going on inside prototyper.jsx needs refactoring. I would prefer not to change much right now especially since it might break something but would definitely work on this later.

@alwx alwx merged commit eb408bb into main Mar 4, 2021
@alwx alwx deleted the playground-callback-dependencies branch March 4, 2021 12:44
@alwx alwx mentioned this pull request Mar 4, 2021
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

Successfully merging this pull request may close these issues.

None yet

2 participants