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: added support for bindings in invokeAPI #1024

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

sagardspeed2
Copy link
Contributor

@sagardspeed2 sagardspeed2 commented Feb 5, 2025

Describe your changes

Added support for bindings in invokeAPI

Screenshots [Optional]

Issue ticket number and link

Closes #848

Checklist before requesting a review

  • I have performed a self-review of my code
  • I have added tests
  • I have added a changeset pnpm changeset add
  • I have added example usage in the kitchen sink app

@sagardspeed2 sagardspeed2 requested a review from evshi February 5, 2025 14:42
@sagardspeed2 sagardspeed2 self-assigned this Feb 5, 2025
Copy link

changeset-bot bot commented Feb 5, 2025

🦋 Changeset detected

Latest commit: 904fc3c

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 5 packages
Name Type
@ensembleui/react-framework Patch
@ensembleui/react-runtime Patch
@ensembleui/react-kitchen-sink Patch
@ensembleui/react-preview Patch
@ensembleui/react-starter Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link
Contributor

github-actions bot commented Feb 5, 2025

Visit the preview URL for this PR (updated for commit 904fc3c):

https://react-kitchen-sink-dev--pr1024-848-use-bindings-in-q97gh7s9.web.app

(expires Wed, 12 Feb 2025 14:44:43 GMT)

🔥 via Firebase Hosting GitHub Action 🌎

Sign: 6267897ade2ba783b6db70a53a60fc3946d625e9

@@ -21,8 +22,14 @@ export const invokeAPI = async (
setter?: Setter,
options?: InvokeAPIOptions,
): Promise<Response | undefined> => {
const evaluated = evaluateDeep(
Copy link
Contributor

Choose a reason for hiding this comment

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

How does this work with the useInvokeAPI hook? That hook clearly checks if the API name exists before invoking.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

if you check useEnsembleAction, in useInvokeAPI we are using useRegisterBindings for evaluate API name and then we check that is API name exists in screenContext before invoking the api, and here when user trigger the api through ensemble.invokeAPI, we are using evaluateDeep to evaluate the api name and then we are checking that name with screenContext and if we found the api, only then we invoke it

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.

Can't use bindings in invoke API name
2 participants