-
Notifications
You must be signed in to change notification settings - Fork 789
feat: app.embed(defs={'mine': value}) #7146
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
base: main
Are you sure you want to change the base?
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
akshayka
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's remove kwargs and only add it if necessary.
There is also I believe a correctness problem, see my comment.
If am down to prioritize this to unblock @zilto, but we need to make sure the correctness issue is resolved.
| if not app_kernel_runner.outputs: | ||
| outputs, glbls = await app_kernel_runner.run( | ||
| set(self._execution_order) | ||
| # Inject provided defs into the kernel's globals | ||
| if defs: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Today app.embed() executes the app once and then serves cached outputs thereafter.
What happens if app.embed() is called with one defs relation, then called again with another defs relation? I think as written in this PR the user will get stale results, because app_kernel_runner.outputs will be non empty.
So, I think we need to retain some kind of cache that is keyed by a tuple of (key, value) pairs in defs.
1735495 to
ba68668
Compare
| # Check second result with first override - output then defs | ||
| assert "x is large" in result_override.output.text | ||
| assert "x is small" not in result_override.output.text | ||
| assert result_override.defs["x"] == 100 | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@akshayka this current fails. Is this the behavior you were thinking of, or a different issue?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, this is an example of the incorrect logic.
📝 Summary
Enables the override of values into embed, allowing for birectional communication of embedded and parent apps