GitRoot

Craft your forge, Build your project, Grow your community freely
 1---
 2id: "641d"
 3priority: 50
 4assignee: null
 5status: triage
 6---
 7
 8# Can call cache
 9
10In [apex_mermaid](../app/plugins/apex_mermaid/src/main.rs) I was doing:
11
12```go
13p := &Plugin{
14    server: server,
15    canCallCodePlugin: server.CanCallFunc(PLUGIN_CODE, PLUGIN_CODE_FUNC, map[string]string{"code": "", "lang": ""}),
16    canCallMermaidPlugin: server.CanCallFunc(PLUGIN_MERMAID, PLUGIN_MERMAID_FUNC, map[string]string{"code": ""}),
17}
18server.ExportFunc("renderMd", func(args map[string]string) (map[string]string, error) {
19    if p.canCallMermaidPlugin {
20        ...
21    }
22}
23```
24
25But when loading module for conf, there is no right related to project. So server return false. And after that plugin never refresh authorization cache.
26
27To fix quickly I do:
28
29```go
30p := &Plugin{
31    server: server,
32}
33server.ExportFunc("renderMd", func(args map[string]string) (map[string]string, error) {
34    p.canCallCodePlugin = server.CanCallFunc(PLUGIN_CODE, PLUGIN_CODE_FUNC, map[string]string{"code": "", "lang": ""})
35    p.canCallMermaidPlugin = server.CanCallFunc(PLUGIN_MERMAID, PLUGIN_MERMAID_FUNC, map[string]string{"code": ""})
36}
37```
38
39But need to find a proper fix, and a way to explain to future dev that.