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

Inject script doesn't work with auto-run feature #2985

Open
johnpryan opened this issue Jun 6, 2024 · 3 comments · Fixed by #3002
Open

Inject script doesn't work with auto-run feature #2985

johnpryan opened this issue Jun 6, 2024 · 3 comments · Fixed by #3002
Assignees
Labels
P3 A lower priority bug or feature request type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)

Comments

@johnpryan
Copy link
Contributor

johnpryan commented Jun 6, 2024

There's a timing issue where using the data-run / run=true feature will correctly auto-run, but doesn't run the right code. Instead of running the injected code, it runs whatever main.dart was created by default.

DartPad probably needs to know that it is waiting on an injected script, and then wait for that code before triggering the auto-run feature.

cc: @parlough @tugorez

@johnpryan johnpryan added type-bug Incorrect behavior (everything from a crash to more subtle misbehavior) P1 A high priority bug; for example, a single project is unusable or has many test failures labels Jun 6, 2024
@tugorez
Copy link

tugorez commented Jun 13, 2024

This is awesome, thanks both @johnpryan and @parlough :D!

I was playing with data-run="true" and found that although it actually auto renders the UI it seems I'm still able to see the default program for a second.

dartpad_autorun.webm

@parlough
Copy link
Member

Yeah. I'm not sure how to avoid that 100% of the time without requiring a special flag to indicate not to run the initial script or gist. I might be able to adjust the order a bit and avoid running the initial script if a message was received from the embedder. I'll play around a bit.

@parlough parlough reopened this Jun 13, 2024
@parlough parlough self-assigned this Jun 13, 2024
@parlough parlough added P3 A lower priority bug or feature request and removed P1 A high priority bug; for example, a single project is unusable or has many test failures labels Jun 13, 2024
@devoncarew
Copy link
Member

@tugorez - I believe you're experimenting with re-mixing the dartpad UI a bit?

Instead of hosting the embedded view in a page, you might also consider forking and modifying the dartpad UI directly? As a Flutter web app, the UI components are reasonably modular, and it should be pretty quick to experiment with.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P3 A lower priority bug or feature request type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants