From 97aa3ecd93e859b937043cd0af228690b255d3b4 Mon Sep 17 00:00:00 2001 From: Soreine Date: Wed, 26 Oct 2016 15:59:06 +0200 Subject: [PATCH] Deprecating using setNode to update `nodes` --- src/transforms/apply-operation.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/transforms/apply-operation.js b/src/transforms/apply-operation.js index 32720c0c4..2b77259da 100644 --- a/src/transforms/apply-operation.js +++ b/src/transforms/apply-operation.js @@ -1,5 +1,6 @@ import Debug from 'debug' +import warning from '../utils/warning' /** * Debug. @@ -294,6 +295,12 @@ function setNode(state, operation) { const { path, properties } = operation let { document } = state let node = document.assertPath(path) + + // Deprecate using setNode for updating children + if (properties.nodes && properties.nodes != node.nodes) { + warning('Updating Node.nodes through setNode is deprecated. Use the appropriate insertion and removal functions, rather than, for example, setNodeByKey.') + } + node = node.merge(properties) document = document.updateDescendant(node) state = state.merge({ document })