{"record":{"id":"5cff07642459a3dd","repo":"plotly/plotly.js","slug":"full-array-edits-are-incompatible-with-other-edits","errorCode":null,"errorMessage":"Full array edits are incompatible with other edits","messagePattern":"Full array edits are incompatible with other edits","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"src/plot_api/manage_arrays.js","lineNumber":78,"sourceCode":" *  a (possibly modified for gui edits) nestedProperty constructor\n *  The modified version takes a 3rd argument, for a prefix to the attribute\n *  string necessary for storing GUI edits\n *\n * @returns {bool} `true` if it managed to complete drawing of the changes\n *  `false` would mean the parent should replot.\n */\nexports.applyContainerArrayChanges = function applyContainerArrayChanges(gd, np, edits, flags, _nestedProperty) {\n    var componentType = np.astr;\n    var supplyComponentDefaults = Registry.getComponentMethod(componentType, 'supplyLayoutDefaults');\n    var draw = Registry.getComponentMethod(componentType, 'draw');\n    var drawOne = Registry.getComponentMethod(componentType, 'drawOne');\n    var replotLater = flags.replot || flags.recalc || (supplyComponentDefaults === noop) || (draw === noop);\n    var layout = gd.layout;\n    var fullLayout = gd._fullLayout;\n\n    if(edits['']) {\n        if(Object.keys(edits).length > 1) {\n            Loggers.warn('Full array edits are incompatible with other edits',\n                componentType);\n        }\n\n        var fullVal = edits[''][''];\n\n        if(isRemoveVal(fullVal)) np.set(null);\n        else if(Array.isArray(fullVal)) np.set(fullVal);\n        else {\n            Loggers.warn('Unrecognized full array edit value', componentType, fullVal);\n            return true;\n        }\n\n        if(replotLater) return false;\n\n        supplyComponentDefaults(layout, fullLayout);\n        draw(gd);\n        return true;\n    }","sourceCodeStart":60,"sourceCodeEnd":96,"githubUrl":"https://github.com/plotly/plotly.js/blob/1d090e0b5ffb8d0fdf6e0e4ff51d3f3cf67f1314/src/plot_api/manage_arrays.js#L60-L96","documentation":"In applyFullArray Edits (src/plot_api/manage_arrays.js), an edit object with the empty-string key '' means a full-array replacement (a 'full array edit'). Plotly forbids mixing that with per-object/per-index edits in one relayout/React call and warns when other keys are present alongside ''.","triggerScenarios":"A single Plotly.update/relayout style edit object containing both {'': newFullArray} and other keys like {'0': {...}} or named attribute edits for the same componentType (e.g. combining a whole new annotations array with edits to individual annotations).","commonSituations":"Programmatic edit builders that merge a full array reset with targeted per-index updates, or generic 'apply all pending edits' code that flattens different edit granularities into one object.","solutions":["Split the edits into two calls: first apply the full-array edit ('' key), then apply per-index/object edits.","Drop the '' full-array edit if you only need targeted changes.","Drop the per-index edits if you intend to replace the whole array.","Audit edit-building code so full replacements and incremental edits are never merged into one payload."],"exampleFix":"// before\napplyEdits({ '': newArr, 0: { x: 1 } }); // mixed\n// after\napplyEdits({ '': newArr });\napplyEdits({ 0: { x: 1 } });","handlingStrategy":"validation","validationCode":"function assertNotMixed(edits) {\n  const keys = Object.keys(edits);\n  if (edits[''] !== undefined && keys.length > 1) {\n    throw new Error('Full array edits must not be combined with per-index edits');\n  }\n}","typeGuard":"function isFullArrayOnly(edits) { return Object.keys(edits).length === 1 && '' in edits; }","tryCatchPattern":null,"preventionTips":["Never merge full-array replacements and per-index edits into one payload.","Sequence edits: full replacement first, incremental edits after.","Centralize edit construction so the two forms cannot be combined accidentally."],"tags":["relayout","array-edits","api-misuse"],"backgroundTag":"incompatible-edit-combination","analyzedSha":"1d090e0b5ffb8d0fdf6e0e4ff51d3f3cf67f1314","analyzedAt":"2026-09-02T22:03:39.906Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-10T02:17:09.455Z"}