@@ -29,39 +29,47 @@ const FormulaCell = (mdProps: CellComponentProps) => {
2929
3030 useEffect ( ( ) => {
3131 if ( formulaRef . current !== null ) {
32- formulaRef . current . innerHTML = "" ;
32+ const effectCallback = async ( ) => {
33+ formulaRef . current . innerHTML = "" ;
3334
34- const formulaResponse = formulaInfo
35- . runFormula (
36- tableColumn . config . formula_query ,
37- formulaRow ,
38- configInfo . getLocalSettings ( )
39- )
40- . toString ( ) ;
41-
42- renderMarkdown ( defaultCell , formulaResponse , formulaRef . current , 5 ) ;
35+ const formulaResponse = formulaInfo
36+ . runFormula (
37+ tableColumn . config . formula_query ,
38+ formulaRow ,
39+ configInfo . getLocalSettings ( )
40+ )
41+ . toString ( ) ;
4342
44- // Save formula response on disk
45- if (
46- tableColumn . config . persist_formula &&
47- formulaCell !== formulaResponse
48- ) {
49- const newCell = ParseService . parseRowToLiteral (
50- formulaRow ,
51- tableColumn ,
52- formulaResponse
43+ await renderMarkdown (
44+ defaultCell ,
45+ formulaResponse ,
46+ formulaRef . current ,
47+ 5
5348 ) ;
5449
55- dataActions . updateCell (
56- row . index ,
57- tableColumn ,
58- newCell ,
59- columnsInfo . getAllColumns ( ) ,
60- configInfo . getLocalSettings ( )
61- ) ;
62- }
50+ // Save formula response on disk
51+ if (
52+ tableColumn . config . persist_formula &&
53+ formulaCell !== formulaResponse
54+ ) {
55+ const newCell = ParseService . parseRowToLiteral (
56+ formulaRow ,
57+ tableColumn ,
58+ formulaResponse
59+ ) ;
60+
61+ await dataActions . updateCell (
62+ row . index ,
63+ tableColumn ,
64+ newCell ,
65+ columnsInfo . getAllColumns ( ) ,
66+ configInfo . getLocalSettings ( )
67+ ) ;
68+ }
69+ } ;
70+ effectCallback ( ) ;
6371 }
64- } , [ row ] ) ;
72+ } , [ formulaRow ] ) ;
6573 return (
6674 < span
6775 ref = { formulaRef }
0 commit comments