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

Is there a way to know when the rendering of a component is finished? #596

Open
fomalhautb opened this issue May 24, 2023 · 3 comments
Open

Comments

@fomalhautb
Copy link

I tried using hook in a component useEffect(() => {...}, []) but the hook is executed before the component is finished rendering. Any way to trigger a function when the component is finished rendering?

@vadimdemedes
Copy link
Owner

What is your use case?

@fomalhautb
Copy link
Author

fomalhautb commented May 25, 2023

What is your use case?

I am building an AI copilot for CLI. (similar to this but open sourced).

The user types a prompt, when the command is generated, the user can decide to execute the command or do some other actions. If the user decide to execute the command, I want to leave a final message before the command is executed so the user can scroll back and find useful information. Basically like this:

Before execution

Prompt: list all files
Generation: ls

> (1) execute
  (2) edit
  (3) discard

After execution

Prompt: list all files
Executed Command: ls

Execution Result:
- file 1
- file 2
...

So I want to execute the command with spawn only when the final message is finished rendering by ink

@vadimdemedes
Copy link
Owner

Not sure I still understand it. How would you do it in React, if it was on the web, not a terminal?

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

2 participants