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: allow running ya.sync in a sync plugin call #702

Merged
merged 1 commit into from
Feb 20, 2024

Conversation

dedukun
Copy link
Contributor

@dedukun dedukun commented Feb 20, 2024

This fixes a issue (yazi would panic) I encountered when calling an async plugin that uses ya.sync synchronously, which happened because I was creating a setup function for a plugin.

@sxyazi sxyazi changed the title fix: Allow running ya.sync in a sync plugin call fix: allow running ya.sync in a sync plugin call Feb 20, 2024
@sxyazi
Copy link
Owner

sxyazi commented Feb 20, 2024

Thanks! Looks good to me.

@sxyazi sxyazi merged commit ed22be7 into sxyazi:main Feb 20, 2024
5 checks passed
@dedukun dedukun deleted the fix-yasync branch February 20, 2024 18:24
@dedukun
Copy link
Contributor Author

dedukun commented Feb 20, 2024

@sxyazi I think it's best to revert this change, I though that I had tested this but it seems that this solution is not working as expected.

When trying to add a bookmark with https://github.com/dedukun/bookmarks.yazi the plugin panics with the error

  2024-02-20T22:50:43.706643Z ERROR yazi::lives::lives: error converting Lua nil to function
    at yazi-fm/src/lives/lives.rs:66

For some reason the if condition with ya.SYNC_ON is met when using the ya.sync method in entry asynchronously (even though it works correctly if the method exists but is not called, which makes it seem that it is loaded correctly).

@sxyazi
Copy link
Owner

sxyazi commented Feb 21, 2024

Okay, I'll fix it in the next PR.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 7, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants