We have a bug open against Photoshop for this issue but in the meantime you can use this workaround:
app.activeDocument.activeLayer.visible = app.activeDocument.activeLayer.visible
1 person found this helpful
When you ask app-specific questions, you should really specify the app you are referring to.
I'm guessing you are talking about Photoshop. This seems to be a scripting related question, and you'll probably get better answers on the Photoshop forum: http://forums.adobe.com/community/photoshop/photoshop_scripting
That's ugly, but it works, thanks.
One more note, this works unless you call this on background or locked layer. IMHO, the better way would to modify the isDirty (true|false) property on document using appropriate Action. I found the property now as long as did some dump of ActionDescriptor on Document. Btw., if you have snippet for building Action, it'll save me some time .