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

confirmActionFunc is not supporting a compromised async function #6736

Closed
jiyuan12354 opened this issue Aug 17, 2023 · 7 comments
Closed

confirmActionFunc is not supporting a compromised async function #6736

jiyuan12354 opened this issue Aug 17, 2023 · 7 comments
Assignees
Labels
enhancement user issue An issue or bug reported by users
Milestone

Comments

@jiyuan12354
Copy link

Our company is bought surveyjs Pro, and we use the surveyjs to render a questionare form. surveyjs is powerful,but I want to post a issue here which other team may also interested in.

surveyjs did provide a property named confirmActionFunc , attempt to provide a customized feature for users to overwrite the default window.comfirm, but I checked the source code, surveyjs don't accept any promised/async confirmActionFunc in this case...and you may know user can't provide a sync function to get confirm result immediately, so the case is confirmActionFunc is not work for the real case

This is requesting a feature

I am requesting a feature, related to confirmActionFunc, I'd like overwrite the default confirmAction function with a promised customized confirmAction

What is the current behavior?

panel will be removed no matter my promised confirmActionFunc execute result, becasue surveyjs will regard the confirmActionFunc as a sync function which return true/false immediately

What is the expected behavior?

I’d like to see that surveyjs supporting the async confirmActionFunc, so that I can render my own customized confirm modal as I want

@andrewtelnov
Copy link
Member

@jiyuan12354 Our UI widgets works in sync mode. However, in fact, you are not the first person who are asking about making confirmActionFunc async. Let me see what we can do here.

Thank you,
Andrew

@andrewtelnov
Copy link
Member

@jiyuan12354 Please review this PR.

Thank you,
Andrew

@andrewtelnov andrewtelnov added this to the v1.9.104 milestone Aug 17, 2023
@andrewtelnov
Copy link
Member

andrewtelnov commented Aug 17, 2023

Here is the example of using
UPDATED:

//Example of using
Survey.settings.confirmActionAsync = (message, resCallback) => {
  setTimeout(() => {
    if(confirm(message)) resCallback(true);
  }, 300);
  return true; //should return true
};

Thank you,
Andrew

@jiyuan12354
Copy link
Author

jiyuan12354 commented Aug 18, 2023

Thanks @andrewtelnov maybe I am not the expert. could you tell me, based on this branch features/6736-confirmActionAsync how could I package the survey-core in my local env, I want to test it the pr in my local env

@jiyuan12354
Copy link
Author

I ran yarn build_prod and copy the build/survey-core to my projects node_modules, seems work fine.
Thanks @andrewtelnov again, please let me know if you release the new package to npmjs.com

@andrewtelnov
Copy link
Member

@jiyuan12354 Great! We release every week. This PR should be merged with master today or on Monday. We commonly release every Tuesday/Wednesday.

Thank you,
Andrew

@andrewtelnov
Copy link
Member

@jiyuan12354 We are goint to release new version today. I have just renamed confirmActionAsyncFunc into confirmActionAsync. Please take it into account. Here is my commit.

Thank you,
Andrew

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement user issue An issue or bug reported by users
Projects
None yet
Development

No branches or pull requests

2 participants