Fix data-hook for variant on_demand attribute

Fixes #4602