LearnNewsExamplesServices
Frontmatter
id18975
titleSetting responsive twice before its plugin has loaded adds two Responsive plugins
stateClosed
labels
bugcore
assigneesneo-opus-ada
createdAtSep 19, 2026, 5:13 PM
updatedAtSep 19, 2026, 5:38 PM
githubUrlhttps://github.com/neomjs/neo/issues/18975
authorneo-opus-ada
commentsCount0
parentIssuenull
subIssues[]
subIssuesCompleted0
subIssuesTotal0
contentTrust
projected
quarantined0
signals[]
blockedBy[]
blocking[]
closedAtSep 19, 2026, 5:38 PM

Setting responsive twice before its plugin has loaded adds two Responsive plugins

neo-opus-ada
neo-opus-ada commented on Sep 19, 2026, 5:13 PM

Context

@neo-opus-vega spotted this by reading, as the twin of the cellEditing race @neo-gpt-emmy found in #18964, fixed by #18967. I measured it on 2026-09-19 at dev@4802862b73.

The Problem

component.Base#afterSetResponsive checks getPlugin('responsive'), then awaits the plugin's import(), then appends a plugin config. Two responsive values set before that import settles both pass the check, so both continuations append.

Measured with a unit probe that shadows the instance's plugins config, so no plugin is built and only admission counts. responsive = {small: {cls: ['a']}} followed in the same tick by responsive = {small: {cls: ['b']}} assigns plugins twice, and the last assignment carries two Responsive entries. Each of those plugins wires its own viewport resize listener and applies the owner's responsive config on every resize. Measured again with real plugin instances: neo-plugin-responsive-1 and -2.

Found while fixing it: a component that turns responsive off throws on its next resize. The plugin stays when responsive becomes null. Its onResize then runs Object.entries(null): Cannot convert undefined or null to object, measured by calling onResize with a landscape rect after responsive = null. The premise below, one plugin serving every later value, holds only once null is a value that plugin serves too, so it is fixed here.

The Architectural Reality

  • src/component/Base.mjs#afterSetResponsive: the lookup runs before await me.trap(import('../../src/plugin/Responsive.mjs')).
  • src/plugin/Responsive.mjs#onResize reads owner.responsive live, so one plugin serves every later value, and the plugin takes no value at creation. It is the plugin's only reader of responsive.
  • #18967 settled the same shape in grid.Container#afterSetCellEditing by deciding admission once the import settles. A lookup made before the import cannot reserve the slot.

The Fix

Decide admission once the import settles: after the await, a continuation that finds a Responsive plugin already present returns without appending. onResize returns early while responsive is off, so the plugin idles until the next value arrives.

Acceptance Criteria

  • Two responsive values set in one tick leave the component with one Responsive plugin. The arm is red on dev.
  • A value set after the plugin exists adds none.
  • With responsive turned off, a resize does not throw, and the next value is applied by the same plugin.
  • The arms build real plugin instances, so getPlugin() is what they exercise, with the plugin's viewport wiring given a stand-in. They do not use the admission-count probe above, which cannot see getPlugin().

Out of Scope

  • Turning responsive off does not remove the plugin; it idles. Removing it would be a separate decision.
  • Other afterSet* hooks that import a plugin: a sweep of getPlugin + import in afterSet bodies belongs to a separate census if one is wanted.

Related

#18964 / #18967 (the grid twin, and the pattern this follows).

Live latest-open sweep: the latest 20 open issues at 2026-09-19T15:12Z, plus an all-state search for afterSetResponsive / "responsive plugin": only #5638 and #5649, both closed and unrelated (Portal responsive behaviour).

Origin Session ID: 6ecb7b5f-dc26-48a3-8e49-7232159377c1 Retrieval Hint: "afterSetResponsive duplicate Responsive plugin admission race import settles getPlugin"