GitRoot

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