Cannot modify twice the parameters on the Attachments Macro

XMLWordPrintable

    • 1
    • Severity 3 - Minor
    • 1

      Issue Summary

      After modifying the default parameters on the Attachments macro it is not possible to change them again.

      This is reproducible on Data Center: (no)

      Steps to Reproduce

      • Edit any confluence page and add the macro "Attachments";
      • Update the page and check its source ("..." > Advanced Details > View Storage Format). Observe that the macro does not contain parameters:
        <ac:structured-macro ac:name="attachments" ac:schema-version="1" data-layout="wide" ac:local-id="cf51f436-b794-4fae-9d0e-21ecfed9da83" ac:macro-id="e8efc5ab-5d87-4b39-a8c9-2057ffb9ec0b" />
        
      • Edit the page again
      • Click the macro to activate the menu and select the Edit icon;
      • The frame menu with the options is presented;
      • Change the default values:
        Parameter Default Value New Value
        Filename patterns empty .*pdf
        Attachment labels empty testis
        Include old attachment versions checked unchecked
        Show previews Unchecked Checked
        Sort by Date createddate
        Sort order ascending descending
        Allow upload Checked unchecked
        Page Title empty test
        Number of items to display empty 100
      • Update the page and check its source ("..." > Advanced Details > View Storage Format). Observe that now a parameter was added for each value changed:
        <ac:structured-macro ac:name="attachments" ac:schema-version="1" data-layout="wide" ac:local-id="b8401a27-b1f0-4ec4-a4e2-d258b4d49e87" ac:macro-id="4d4610c1d173b7a69ff0a117571b17f7">
        <ac:parameter ac:name="patterns">.*pdf</ac:parameter>
        <ac:parameter ac:name="labels">testis</ac:parameter>
        <ac:parameter ac:name="old">false</ac:parameter>
        <ac:parameter ac:name="preview">true</ac:parameter>
        <ac:parameter ac:name="sortBy">createddate</ac:parameter>
        <ac:parameter ac:name="sortOrder">descending</ac:parameter>
        <ac:parameter ac:name="upload">false</ac:parameter>
        <ac:parameter ac:name="page">
           <ac:link><ri:page ri:content-title="test" ri:version-at-save="2" />
           </ac:link>
        </ac:parameter>
        <ac:parameter ac:name="pageSize">100</ac:parameter>
        </ac:structured-macro>
        
      • Edit the page again
      • Edit the macro and change all the values back to the default ones or any other value
      • Update the page and check its source

      Expected Results

      Autosave saved all the changed parameters with the new values.

      Actual Results

      The new values were not saved.
      The same previous values remained:

      <ac:structured-macro ac:name="attachments" ac:schema-version="1" data-layout="wide" ac:local-id="b8401a27-b1f0-4ec4-a4e2-d258b4d49e87" ac:macro-id="4d4610c1d173b7a69ff0a117571b17f7">
      <ac:parameter ac:name="patterns">.*pdf</ac:parameter>
      <ac:parameter ac:name="labels">testis</ac:parameter>
      <ac:parameter ac:name="old">false</ac:parameter>
      <ac:parameter ac:name="preview">true</ac:parameter>
      <ac:parameter ac:name="sortBy">createddate</ac:parameter>
      <ac:parameter ac:name="sortOrder">descending</ac:parameter>
      <ac:parameter ac:name="upload">false</ac:parameter>
      <ac:parameter ac:name="page">
         <ac:link><ri:page ri:content-title="test" ri:version-at-save="2" />
         </ac:link>
      </ac:parameter>
      <ac:parameter ac:name="pageSize">100</ac:parameter>
      </ac:structured-macro>
      

      Workaround

      • Remove the macro from the page and add it back

      Additional Notes

      Documentation

      On our documentation at Insert the attachments macro there is no mention that it cannot be modified twice:

      Configure the parameters. Your changes are saved as you go.
      Resume editing the page, and the panel closes.

      Console Shows the following sequence of Caught and Uncaught exceptions

      After Hitting the edit icon on the Attachments macro:
      1. Extension with type "com.atlassian.confluence.macro.core" and key "attachments" not found!

      async getExtension(type: ExtensionType, key: ExtensionKey) {
          const extension = (await this.manifestsPromise).find(
            (manifest) => manifest.type === type && manifest.key === key,
          );
          if (!extension) {
            throw new Error(
              `Extension with type "${type}" and key "${key}" not found!`,
            );
          }
          return extension;
        }
      

      2. "Error: Failed to execute 'insertRule' on 'CSSStyleSheet': Failed to parse the rule 

          "stack": "Error: Failed to execute 'insertRule' on 'CSSStyleSheet': Failed to parse the rule '.cc-1cab8vv::-ms-clear{display:none;}'.\n    
          at t.insert (https://confluence-v1.prod.atl-paas.net/master/stable_vendors.zaa_QZp4bV.js:2:19589)\n    
          at h (https://confluence-v1.prod.atl-paas.net/master/stable_vendors.zaa_QZp4bV.js:2:27679)\n    
          at Array.d (https://confluence-v1.prod.atl-paas.net/master/stable_vendors.zaa_QZp4bV.js:2:27724)\n    
          at v (https://confluence-v1.prod.atl-paas.net/master/stable_vendors.zaa_QZp4bV.js:2:27814)\n    
          at V (https://confluence-v1.prod.atl-paas.net/master/stable_vendors.zaa_QZp4bV.js:2:21562)\n    
          at Object.a [as insert] (https://confluence-v1.prod.atl-paas.net/master/stable_vendors.zaa_QZp4bV.js:2:27863)\n    
          at o (https://confluence-v1.prod.atl-paas.net/master/stable_vendors.zaa_QZp4bV.js:2:49609)\n    
          at https://confluence-v1.prod.atl-paas.net/master/stable_vendors.zaa_QZp4bV.js:2:46036\n    
          at a (https://confluence-v1.prod.atl-paas.net/master/stable_vendors.zaa_QZp4bV.js:2:60762)\n    
          at S (https://confluence-v1.prod.atl-paas.net/master/stable_vendors.zaa_QZp4bV.js:2:46009)"
      }
      

      Atachments Panel is presented;
      Checking the "allow upload";
      3. Invariant Violation: 8 (see https://github.com/apollographql/invariant-packages)

      stack
      Invariant Violation: Invariant Violation: 8 (see https://github.com/apollographql/invariant-packages)
          at new t (https://confluence-v1.prod.atl-paas.net/master/vendors.HuNEG5h7EI.js:2:295479)
          at https://confluence-v1.prod.atl-paas.net/master/stable_vendors.zaa_QZp4bV.js:2:71295
          at Array.forEach (<anonymous>)
          at e.diffQueryAgainstStore (https://confluence-v1.prod.atl-paas.net/master/stable_vendors.zaa_QZp4bV.js:2:71252)
          at e.readQueryFromStore (https://confluence-v1.prod.atl-paas.net/master/stable_vendors.zaa_QZp4bV.js:2:70632)
          at t.read (https://confluence-v1.prod.atl-paas.net/master/stable_vendors.zaa_QZp4bV.js:2:80290)
          at e.readQuery (https://confluence-v1.prod.atl-paas.net/master/vendors.HuNEG5h7EI.js:2:50571)
          at ie (https://confluence-v1.prod.atl-paas.net/master/36691.qzO9KcfG4C.js:1:7185)
          at https://confluence-v1.prod.atl-paas.net/master/36691.qzO9KcfG4C.js:1:14352
          at Object.children (https://confluence-v1.prod.atl-paas.net/master/app.1MQrvJ2YPt.js:1:640737)
      

      bundle.esm.js

       StoreReader.prototype.diffQueryAgainstStore = function (_a) {
      ...
              var hasMissingFields = execResult.missing && execResult.missing.length > 0;
              if (hasMissingFields && !returnPartialData) {
                  execResult.missing.forEach(function (info) {
                      if (info.tolerable)
                          return;
                      throw process.env.NODE_ENV === "production" ? new InvariantError(8) : new InvariantError("Can't find field " + info.fieldName + " on object " + JSON.stringify(info.object, null, 2) + ".");
                  });
              }
       ...
       

      4. DOMException: "Error: Failed to execute 'measure' on 'Performance': The mark '🦉gapCursorPlugin$::view::update::start' does not exist.

          "stack": "Error: Failed to execute 'measure' on 'Performance': The mark '🦉gapCursorPlugin$::view::update::start' does not exist.\n    
          at i (https://confluence-v1.prod.atl-paas.net/master/42505.tIHJZqAAxF.js:832:18248)\n    
          at o.update (https://confluence-v1.prod.atl-paas.net/master/37874.rtI3dPduqV.js:2296:17961)\n    
          at fn.updatePluginViews (https://confluence-v1.prod.atl-paas.net/master/17269.RGWliGm9EH.js:1:87012)\n    
          at fn.updateStateInner (https://confluence-v1.prod.atl-paas.net/master/17269.RGWliGm9EH.js:1:86105)\n    
          at fn.updateState (https://confluence-v1.prod.atl-paas.net/master/17269.RGWliGm9EH.js:1:84097)\n    
          at ui.dispatchTransaction (https://confluence-v1.prod.atl-paas.net/master/37874.rtI3dPduqV.js:2296:26311)\n    
          at fn.dispatchTransaction (https://confluence-v1.prod.atl-paas.net/master/37874.rtI3dPduqV.js:2296:28105)\n    
          at fn.dispatch (https://confluence-v1.prod.atl-paas.net/master/17269.RGWliGm9EH.js:1:89959)\n    
          at Pc (https://confluence-v1.prod.atl-paas.net/master/37874.rtI3dPduqV.js:2509:43905)\n    
          at https://confluence-v1.prod.atl-paas.net/master/37874.rtI3dPduqV.js:2509:45271"
      }

      5. Cannot assign to read only property 'Symbol(Symbol.toStringTag)' of object '#<Map>'

      TypeError: Cannot assign to read only property 'Symbol(Symbol.toStringTag)' of object '#<Map>'
          at e.exports (https://confluence-v1.prod.atl-paas.net/master/stable_vendors.zaa_QZp4bV.js:2:287263)
          at e.exports (https://confluence-v1.prod.atl-paas.net/master/stable_vendors.zaa_QZp4bV.js:2:275202)
          at e.exports (https://confluence-v1.prod.atl-paas.net/master/stable_vendors.zaa_QZp4bV.js:2:275810)
          at e (https://confluence-v1.prod.atl-paas.net/master/stable_vendors.zaa_QZp4bV.js:2:275525)
          at e.exports (https://confluence-v1.prod.atl-paas.net/master/stable_vendors.zaa_QZp4bV.js:2:285989)
          at e.exports (https://confluence-v1.prod.atl-paas.net/master/stable_vendors.zaa_QZp4bV.js:2:276155)
          at e (https://confluence-v1.prod.atl-paas.net/master/stable_vendors.zaa_QZp4bV.js:2:275525)
          at e.exports (https://confluence-v1.prod.atl-paas.net/master/stable_vendors.zaa_QZp4bV.js:2:285989)
          at e.exports (https://confluence-v1.prod.atl-paas.net/master/stable_vendors.zaa_QZp4bV.js:2:276155)
          at e (https://confluence-v1.prod.atl-paas.net/master/stable_vendors.zaa_QZp4bV.js:2:275525)
      

      getRawTag.js

      function getRawTag(value) {
        var isOwn = hasOwnProperty.call(value, symToStringTag),
            tag = value[symToStringTag];
      
        try {
          value[symToStringTag] = undefined;
          var unmasked = true;
        } catch (e) {}
      ...
      

      6. Cannot read properties of undefined (reading 'size')

      stack: TypeError: Cannot read properties of undefined (reading 'size')
          at ui.onPluginObservation (https://confluence-v1.prod.atl-paas.net/master/37874.rtI3dPduqV.js:2296:22443)
          at qo.callback (https://confluence-v1.prod.atl-paas.net/master/37874.rtI3dPduqV.js:2296:32012)
          at https://confluence-v1.prod.atl-paas.net/master/37874.rtI3dPduqV.js:2296:15585
          at Array.forEach (<anonymous>)
          at PerformanceObserver.<anonymous> (https://confluence-v1.prod.atl-paas.net/master/37874.rtI3dPduqV.js:2296:15568)
      

      ReactEditorView.tsx

      private onPluginObservation = (report: PluginPerformanceReportData) => {
          this.dispatchAnalyticsEvent({
            action: ACTION.TRANSACTION_DISPATCHED,
            actionSubject: ACTION_SUBJECT.EDITOR,
            eventType: EVENT_TYPE.OPERATIONAL,
            attributes: {
              report,
              participants:
                this.pluginInjectionAPI
                  .api()
                  .collabEdit?.sharedState.currentState()
                  .participants.size() || 1,
            },
          });
        };
      

      7. DomException: The transaction was aborted, so the request cannot be fulfilled.

      IndexedDbConnector.ts

      const getResult = await new Promise<GetItemsResult<T>>(
            async (resolve, reject) => {
              const items: ItemWrapperType<T>[] = [];
              let numberOfDeletedItems = 0;
              request.onerror = (error) => {
                logger.error('Failed to open cursor:', error);
                reject('Failed to open cursor');
              };
      

      8. A component definition of type "t" with the ID of "aui-progressbar" already exists.

      Error: A component definition of type "t" with the ID of "aui-progressbar" already exists.
          at Object.set (https://xx/_/download/contextbatch/js/_super/batch.js?assetVersion=1000.0.0-cfbc7173e68c13400&externals=__local-default__&locale=en-US:211:224)
          at f (https://xx/_/download/contextbatch/js/_super/batch.js?assetVersion=1000.0.0-cfbc7173e68c13400&externals=__local-default__&locale=en-US:246:469)
          at https://xx/_/download/batch/com.atlassian.auiplugin:internal-src-js-aui-progress-indicator/com.atlassian.auiplugin:internal-src-js-aui-progress-indicator.js?assetVersion=1000.0.0-cfbc7173e68c13400&amp;externals=__local-default__&amp;locale=en-US:9:85
          at https://xx/_/download/batch/com.atlassian.auiplugin:internal-src-js-aui-progress-indicator/com.atlassian.auiplugin:internal-src-js-aui-progress-indicator.js?assetVersion=1000.0.0-cfbc7173e68c13400&amp;externals=__local-default__&amp;locale=en-US:13:355
       

      batch.js

                       isNativeCustomElement: function(a) {
                          return q() && this.isType(a, m) && o(a)
                      },
                      set: function(a, b) {
                          if (p(i.registry, a))
                              throw Error('A component definition of type "' + b.type + '" with the ID of "' + a + '" already exists.');
                          i.registry[a] = b;
                          return this
                      }
      

      9. Message: Request to add item to table failed
      IndexedDbConnector.ts

      try {
            return await this.globalEventLimitGuard.insertItems(
              objectStore,
              items,
              policy,
            );
          } catch (error) {
            if (shouldIgnoreResilienceDbError(error)) {
              throw error;
            }
            logger.log('Failed to add item to table', error);
            throw new Error('Request to add item to table failed');
          }
        };
      }
      

            Assignee:
            Unassigned
            Reporter:
            Murakami [Atlassian Support]
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: