atomicState doesn't seem to update

(edit: Just clean up, hopefully making it more clear)

In a child app:

    settings['device'].each{singleDevice->
            parent.mergeMaps([state:[state:'on', appId:2227, appType:'time', time:1706627961088]],singleDevice)
    }
   parent.logDeviceTable(settings['device'],'CHILD: ')

In parent app:

def mergeMaps(Map rightMap, singleDevice){
    leftMap = atomicState.'devices'."${singleDevice.id}"
    leftMap.putAll(rightMap)
    atomicState.'devices'."${singleDevice.id}" = leftMap
    logDeviceTable(singleDevice,'PARENT: ')
    return
}

So the child calls the parent mergeMaps, does the merge, logs the result from the parent, then immediately after returning to the childa and logs it again. Logging the exact same atomicState, two results.

PARENT: [hue:[currentLevel:10, stopLevel:100, appType:time, appId:2227, startTime:1706575430463, stopTime:1706575440466, startLevel:10, priorLevel:13], state:[state:on, appId:2227, appType:time, time:1706627961088]]

CHILD: [hue:[currentLevel:10, stopLevel:100, appType:time, appId:2227, startTime:1706575430463, stopTime:1706575440466, startLevel:10, priorLevel:13], state:[appType:time, appId:2227, state:off, time:1706575440574]]

So the "state" key in the atomicState merges correctly with "on" in the parent, but then atomicState value does not carry back to the child app. (The timestamp shows it's getting is the old value.) Am I missing something? How do I get atomicState to sync?

Function logDeviceTable just does that - logs out the atomicState value. Nothing else.

def logDeviceTable(multiDevice,line){
    multiDevice.each{singleDevice->
    log.debug line + '  ' + atomicState.'devices'?."${singleDevice.id}"
    }
}

Seems switching mergeMaps to use state works, but that strikes me as a bad solution, especially with all the warnings of never mixing atomicState and state.

The problem is that you can't usually write a single element of a map to atomicState, only the entire map.

Another way around this issue is to use individual atomicState elements instead of the map, using the name to get the same result. For example,

atomicState."devices.${singleDevice.id}" = leftMap

Wait, so.... If I "replace" the entire map, rather than using just one main key, that would work? That should be just one little extra step. Just tack "rightMap" into "${singleDevice.id}"."${rightMap}" (so to speak), then replace atomicState? Just want to verify before I start changing code that, for the moment, works well enough to not piss the wife off.