DiscussCategory: Plugin installationHow best to unload BEE Plugin in single-page app?
Wouter Van den Broeck asked 2 years ago

When using BEE Plugin in a single-page application (React-based), what is the best way to unload the plugin (while it is not being used) such that it can later be reloaded (in the same page)?

Our current approach (no longer rendering the div with the container ID) results in incoherent issues.

Best regards,


3 Answers
Wouter Van den Broeck answered 2 years ago

To elaborate on the issues in our current approach: the following steps steps result in a plugin error (the dreadfull code 1000):

  1. get token
  2. create plugin
  3. start plugin
  4. open message, save, etc.
  5. unload plugin (by no longer rendering the container)

    6.some delay

  6. render the container again
  7. get token
  8. create plugin
  9. start plugin
  10. open message
  11. save

Now we get the error. At the same time the following request by the plugin fails.

Request URL:

Request Method: POST

Status Code: 400 Bad Request

Remote Address:

Referrer Policy: no-referrer-when-downgrade

Request headers:

POST /api/nlparser?p=false HTTP/1.1


Connection: keep-alive

Content-Length: 2

Accept: application/json, text/plain, /


Authorization: Bearer

User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/66.0.3359.181 Safari/537.36

Content-Type: application/json;charset=UTF-8

DNT: 1


Accept-Encoding: gzip, deflate, br

Accept-Language: en,nl;q=0.9,fr;q=0.8

Response headers:

Access-Control-Allow-Credentials: true


Connection: keep-alive

Content-Length: 0

Date: Thu, 31 May 2018 19:30:27 GMT

Server: Microsoft-IIS/8.5

X-Powered-By: ASP.NET

Wouter Van den Broeck answered 2 years ago

And… actually the above issue had nothing to do with the unloading.

Unloading the plugin by no longer rendering the container seems to be stable.

Matt answered 2 years ago

We have a React starter on GitHub. Perhaps this will help?

The 400, bad request, is likely from calling "save()" or "preview()" before the template fully loads.

You can use the "onLoad()" to determine when it is safe to obtain the HTML from the parser.

Your Answer