#4634·noctalia

[BUG] barWidget.isVertical() returns false inside noctalia.state.watch callbacks

Author: AnthonySmithDevCreated Sep 29, 2026Updated Sep 29, 2026

Submission checklist

  • I have searched existing issues and confirmed this is not a duplicate.
  • I am using the latest available version of Noctalia.

Bug description

Follow-up to #4488 / #4510, which fixed isVertical() on first load. It still returns false whenever a bar widget renders from a noctalia.state.watch callback, so a plugin on a left/right bar flips between its vertical and horizontal layout: vertical after each update() tick, horizontal every time its service publishes new state.

Cause

enqueueStateWatchResult() (src/scripting/script_runtime.cpp:501) builds the ScriptEvent without a snapshot. beginCall(event.snapshot) (:653) then runs the callback with a default ScriptSnapshot, whose isVertical is false, so luau_isVertical (src/scripting/plugin_bindings.cpp:208) reports false. enqueueStreamLine seems to have the same gap. Every other path (update, gestures, onIpc, onAudioSpectrum) passes makeScriptSnapshot().

Steps to reproduce

  1. Put a plugin widget that renders from a watcher on a position = "left" bar, e.g. any widget doing noctalia.state.watch(KEY, function(v) render(v) end) with render() calling barWidget.isVertical().
  2. Wait for its service to publish: the widget switches to the row layout until the next update().

Affected plugins in the wild: felipeartur/ai-usagebar (bar.luau:487, re-renders from watchers at :529/:537). The blackbartblues/audio-switcher "hide % when vertical" check also fails this way.

Suggested fix

Keep the widget's latest snapshot in the runtime (it is already produced for every enqueueUpdate/gesture) and attach it to StateWatchResult and stream events.

Plugin-side workaround

Cache barWidget.isVertical() at script load and in update(), and render from the cached value.

Version

noctalia v5.2.0 (also present in main @ d07fdd3), Umbriel, Arch Linux.