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

Trigger for clientside callbacks #318

Merged
merged 3 commits into from
May 4, 2024
Merged

Conversation

frnhr
Copy link
Contributor

@frnhr frnhr commented Mar 27, 2024

From TriggerTransform:

NOTE: This transform cannot be implemented for clientside callbacks since the JS can't be modified from here.

I respectfully beg to differ.

We can wrap the callback JS function in another function which takes out the trigger args.

Roughly like this:

// original callback:
function(important, _irrelevant, interesting) {
    return important * interesting;
}


// wrapped callback:
function(important, _irrelevant, interesting) {
    const func = function(important, interesting) {  // <-- '_irrelevent' removed
        return important * interesting;
    };
    return func(important, interesting);
}

Implementation is in this PR.

Copy link

codecov bot commented Mar 27, 2024

Codecov Report

Attention: Patch coverage is 83.33333% with 2 lines in your changes are missing coverage. Please review.

Project coverage is 77.75%. Comparing base (1e70fed) to head (38c2324).

Files Patch % Lines
dash_extensions/enrich.py 83.33% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #318      +/-   ##
==========================================
+ Coverage   77.69%   77.75%   +0.06%     
==========================================
  Files          11       11              
  Lines        1058     1070      +12     
==========================================
+ Hits          822      832      +10     
- Misses        236      238       +2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@frnhr frnhr marked this pull request as ready for review March 27, 2024 23:27
@emilhe
Copy link
Owner

emilhe commented May 4, 2024

Ah, yes, you are correct! Very elegant solution - I didn't think of that at the time ;)

@emilhe emilhe merged commit eb8efba into emilhe:master May 4, 2024
6 checks passed
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.

2 participants