Answered

Edit web-plugin after install

  • 31 October 2020
  • 6 replies
  • 916 views

I’m new to creating plugin for Miro. I have created a test plugin by follwing https://developers.miro.com/docs/how-to-start this & successfully added to my board. But how to modify/change my plugin after installation. When I change the code in index.js file of my web page which is hosted in the web plugin url, the plugin does not affect. It keeps un changed. How to update my plugin to affect changes.

Thank you

icon

Best answer by Max Harper 1 November 2020, 02:49

View original

6 replies

Userlevel 7
Badge +5

@CSA welcome!  Cool to hear you’re tinkering with developing Miro plugins.   

so… let’s see.. first thing to know is that your index.js is accessed and loaded into the Miro browser/app session at the moment a board is loaded. What that means is, to refresh index.js you must refresh the board (/browser page). 
However- if you’re refreshing the page/board and index.js is not updating it is most likely→ that you’re running up against the natural manner by which caching works on the browser  - whereby your original cached index.js is what’s continually being accessed/loaded by the browser. The app’s request never reaches back to the server and gets the new index js. 

Option A) clear browser cache after each update: 

 

Option B) use ‘Nodemon’ or other build/serve tools will listen to updates on the local file system and restart your server— in so doing it will allow the browser to fetch a new index.js  

— if you’re using ngrok: leave ngrok alone — just restart the http-server underneath it. In Your CLI this should be easy enough … (ctrl+c  stops the server - then arrow up will retype the http-server start command and then

https://www.npmjs.com/package/nodemon

 

  1. either with vanilla http-server or by setting your app as a node ‘express’ server—  use the http response header  “cache-control: no-cache” 

https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cache-Control

D) Glitch: this tool is suuuuper useful for prototyping Miro apps. It automatically handles the listen-to-updates-and -reserve process. 
 

—— 

hope this solves your issue. DM me if you’re like more support or want to connect with someone passionate about making Miro plugins :) 

 

cheers

max 

Userlevel 7
Badge +12

Thanks for the excellent and detailed explanation @Max Harper! I did some web development work about 15 years ago, but never any kind of SDK/hosted web-plugin stuff. Since finding Miro, though, I have had a few ideas for some web-plugins and this information will help in my journey. So far, I have only set up my Miro development team and started mapping out my feature/plugin ideas.

Since I'm here and on the topic, I have two questions:

1. Is there a website that you could refer me to that has a good interactive course/explanation on building web-plugins - one that you think is in-line with how Miro's SDK works?

2. Which site would you recommend for hosting my files?

Thank you very much for the more detailed answer. I will try them. Thanks again.

As in one of your options stated, I set cache control to no cache. It worked. Thanks.

 

Let me add some more details if anyone have this same issue.

I’m using  firebase static hosting & set “Cache-Control” to “no-cache” by following this https://stackoverflow.com/a/46667978/13396193

 

Userlevel 7
Badge +5

Thanks for the excellent and detailed explanation @Max Harper! I did some web development work about 15 years ago, but never any kind of SDK/hosted web-plugin stuff. Since finding Miro, though, I have had a few ideas for some web-plugins and this information will help in my journey. So far, I have only set up my Miro development team and started mapping out my feature/plugin ideas.

Since I'm here and on the topic, I have two questions:

1. Is there a website that you could refer me to that has a good interactive course/explanation on building web-plugins - one that you think is in-line with how Miro's SDK works?

2. Which site would you recommend for hosting my files?

@Robert Johnson

Would love to get you geared up to tinker. Have been thinking of many videos / Ed resources here. Have actually been considering producing a video series on “how to make a Miro plugin” ... 

would you be willing to connect this week so I might learn where you are at in coding knowledge, what gaps you need filled in ... and from there we can try to get you prepared to hack on Miro plugins. 

Userlevel 7
Badge +12

@Max Harper - I am onboard with all of this - thank you for offering to discuss this with me! Surely a video series/any tutorial would be appreciated by many others too. I will reach out to you in a private message.

Reply