Skip to content

addCustomLoadOverride and addCustomSaveOverride callbacks require a return value #22

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

Open
tdulcet opened this issue Jul 2, 2022 · 1 comment
Labels
bug Something isn't working

Comments

@tdulcet
Copy link

tdulcet commented Jul 2, 2022

The AutomaticSettings.Trigger.addCustomLoadOverride() and AutomaticSettings.Trigger.addCustomSaveOverride() callbacks require a return value. The README says:

By default, the library assumes you now handle loading and saving by yourself, i.e. you need to interact with the HTML DOM (for loading) or the storage API (for saving) directly.

which implies that a return value should not be required. However, not providing the return value results in an exception, which prevents the options page from fully loading:
image

The issue is several lines like this:

// destructure data, if it has been returned, so next call can
// potentially also use it
if (result.command === CONTINUE_RESULT) {
that do not first check that the result from the callback is defined before using it.

@rugk
Copy link
Member

rugk commented Jul 5, 2022

Yeah hmm… sounds reasonable. So what should happen if you return no value? (Just ignore all further handling I guess?)

Looking at the doc, I see that I guess I mostly used it with AutomaticSettings.Trigger.overrideContinue.overrideContinue and your use case was never really tested.

So a PR is very well appreciated.

@rugk rugk added the bug Something isn't working label Jul 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants