Resolve conflicts panel shows -1 unresolved conflict
Current Behavior
There are two conflicts with one checkbox. After selecting it, the display shows "-1 unresolved conflict" and the "Save conflict resolution" button is disabled.
Expected Behavior
It should show "0 unresolved conflicts" after making selection, and the save button should be clickable.
Steps To Reproduce
When I added a console log inside this if block:
I saw 55f39f549b6c2eb8 appear twice. This caused the (2-3=-1) unresolved conflict issue.
This happens because the selector $(".red-ui-diff-selectbox>input:checked") matches all checked radio inputs, including those for both the node itself and its properties (with -props in the id). So, for a single conflict node, there may be multiple checked inputs: one for the node and one for its properties.
The resolutionCount should only increase when the id is unique.
This may fix the bug:
var uniqueConflictIds = new Set();
$(".red-ui-diff-selectbox>input:checked").each(function() {
var nodeId = $(this).data('node-id');
if (currentDiff.conflicts[nodeId]) {
uniqueConflictIds.add(nodeId);
}
currentDiff.resolutions[nodeId] = $(this).val();
})
var resolutionCount = uniqueConflictIds.size;Example flow
paste your flow hereEnvironment
run with docker:
docker run -it -p 1880:1880 -v myNodeREDdata:/data --name mynodered nodered/node-red:4.1.3
Source: node-red/node-red