-
Notifications
You must be signed in to change notification settings - Fork 33
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
Async and real-time formulas support #1935
Comments
Hello @dberardo-com Async formulas (formulas returning a promise) aren't supported directly. However, it's not difficult to implement an async behavior on top of your custom function. promise.then((result) => {
// store the result somewhere
// and dispatch a new evaluation to use the result
this.dispatch("EVALUATE_CELLS");
}); You can find more explanation in the documentation: https://github.com/odoo/o-spreadsheet/blob/16.0/doc/add_function.md#asynchronous-function Let me know it anything is unclear. You can implement the same strategy with real-time websocket when new data comes. |
Without any update for three months, I will close this issue. Regards |
looks great, i was able to test the async loop with the documentation you provided. here a couple of issues:
here a couple of questions:
cheers |
Hello @dberardo-com
The doc isn't up-to-date. Thanks for pointing that. I'll fix it. You can use any "UI plugin" it doesn't really matter for such things.
You assumed correctly, every plugin is instantiated once. You have to manage different caches or cache keys. The strategy is up to you. We usually use the functions arguments to build the key. And we used different caches for different functions (or even different plugins).
Yes you can! You can use import { helpers } from "@odoo/o-spreadsheet";
const { EvaluationError, CellErrorLevel } = helpers;
throw new EvaluationError("#LOADING", "The data is loading", CellErrorLevel.silent);
// or create an other error
class LoadingDataError extends EvaluationError {
constructor() {
super("#LOADING", "The data is loading",CellErrorLevel.silent);
}
}
// then
throw new LoadingDataError(); |
thanks a lot, i think documentation would benefit greatly from this latest piece of information |
does the spreadsheet support async formulas (promises) and real-time ones (websockets) ?
in the first case, all cells referencing the async formula will be reprocessed when the promise resolves, in the second case, all references will reprocess when a new value "reaches" the formula and generates a different output (cache-invalidation)
The text was updated successfully, but these errors were encountered: