[user macro] Issue with server id/macros loading indefinitely

Hello,

I have some issues with my custom user macros. So the initial context is that I have some pages created from a model page, on those pages I have 5 macros in total doing JQL requests and the only parameter that changes on the different pages is a Jira issue key. So I wanted to replace the standard macros by my own user macros so that the creator of the page would need to type the issue key only once somewhere in the page (or even as a parameter in a single macro), and all the macros on my page would get the key to self update on the page creation.
To do so, I created one macro with a body that wrap the property table where I put the issue key :


## @noparams

## Create a div with a unique id
#set($id = $action.dateFormatter.calendar.timeInMillis)
<div id="ppContainer$id">$body</div>

<script type="text/javascript">

// This function is used by the macros that need the searched value. It is created here so there is no need to duplicate it in those other macros. 
// It create an ajax request to insert the markup (macros code before being processed to html code by Confluence) in the containingElement designated by its id (e.g. a div, a span). 
function renderAndInsertMarkup(markup, containingElement) {
   var dataObj = {};
   dataObj.representation = "storage";
   dataObj.content = {};
	dataObj.content.id = AJS.params.pageId;
	dataObj.value = markup;

	jQuery.ajax({dataType: 'json',
 		contentType: 'application/json',
 		type: 'POST',
 		url: contextPath + '/rest/api/contentbody/convert/view',
 		data: JSON.stringify(dataObj),
 		success: function(response) {
   		jQuery(containingElement).append(response.value);
 		}
	});
};

AJS.toInit(function(){
   // This would target a specific key/value pair row.
   var row = AJS.$('#ppContainer${id} .plugin-tabmeta-details table th:contains("Issue key")').parent();
   var value =  AJS.$('td', row).text();
   // Calls the functions in the associated macros
   fonctionsAssocieesFunction(value);
   exigencesAssocieesFunction(value);
   jiraStatusFunction(value);
   jiraLinkFunction(value);
});
</script>

And the other custom macros look like this (the main difference is the JQL request) :


## @noparams

## Creates a span with a unique id
#set($id = $action.dateFormatter.calendar.timeInMillis)
<span id='ppContainer$id'></span>

<script type="text/javascript">

// Insert a macros inside the created span 
function fonctionsAssocieesFunction(value){
renderAndInsertMarkup(`<ac:structured-macro ac:name="jira" ac:schema-version="1" ac:macro-id="[randomMacroId]"><ac:parameter ac:name="server">[myservername]</ac:parameter><ac:parameter ac:name="columns">id,summary</ac:parameter><ac:parameter ac:name="maximumIssues">20</ac:parameter><ac:parameter ac:name="jqlQuery">project = MyProject AND issuetype = Fonction AND status not in (Closed) AND issueFunction in linkedIssuesOf(&quot;key=` + value + `&quot;,&quot;relates to&quot;) </ac:parameter><ac:parameter ac:name="serverId">[myserverid]</ac:parameter></ac:structured-macro>`, "#ppContainer$id");
};
</script>

Those macros work fine when I have a standard macro doing a JQL request but if they are the only macros requesting Jira on the page, they keep loading indefinitely. I have noticed that when I check the storage format of my page, the custom macro won’t show the parameter “serverId” even if it’s indicated in it. Do have any idea of why it does this ?
Thank you for your help.

Anthony M.