View.submit() updates rich-text bodied macros on first call but not on subsequent calls in Confluence macro

I’m building a Confluence macro with a custom config panel using Forge Custom UI. The config panel has two buttons that submit different body content using view.submit().

  • :white_check_mark: First button click: Body updates correctly in the macro

  • :cross_mark: Second button click: view.submit() is called with correct body and config, but the macro doesn’t update the body

Macro rendered : (button 1 clicked then button 2)

image

const handleTestSubmit = async (buttonText, buttonNumber) => {
try {
const ctx = await view.getContext();

const testBody = doc(
  paragraph(
    placeholder({
      text: buttonText,
    })
  )
);

const testConfig = { testButtonClicked: buttonNumber };

console.log('Test: Submitting body:', JSON.stringify(testBody, null, 2));
console.log('Test: Submitting config:', JSON.stringify(testConfig, null, 2));

await view.submit({
  config: testConfig,
  body: testBody
});

console.log('Test: Submit completed successfully');
setMessage(`✓ Button ${buttonNumber} submitted successfully!`);

} catch (err) {
console.error(‘Test submit error:’, err);
setMessage(✗ Error: ${err.message});
}
};

// Two buttons:
<Button onClick={() => handleTestSubmit(‘This is button 1’, 1)}>Button 1
<Button onClick={() => handleTestSubmit(‘This is button 2’, 2)}>Button 2


Observations:

  1. Both button clicks successfully log the correct body and config to the browser console

  2. The config panel closes after each submit (expected behavior)

  3. The body is properly constructed using ADF builders (doc(), paragraph(), placeholder())

  4. No error codes are thrown (INVALID_EXTENSION_TYPE, INVALID_BODY, etc.)

Environment:

  • Forge Confluence Macro

  • React 18.3.1

  • @atlaskit/adf-utils/builders for ADF generation

Any guidance would be appreciated! :folded_hands:

Hi everyone, I’m still stuck.

To recap: I am calling view.submit() multiple times from a Custom UI configuration panel. The macro body in the Confluence editor only updates after the first click.

New observations:

  1. First Click:

    view.submit({ config, body })
    

    → Macro body updates instantly in the editor.

  2. Second Click (without refreshing the page):

    view.submit({ config, body })
    

    → The config side-panel closes, logs show success, but the macro body in the editor remains stuck on the content from the first click.

Are there a defect about view.submit() ?

1 Like

@CreateIssue There is ECO ticket raised to track the issues here https://jira.atlassian.com/browse/ECO-1249 .

1 Like