Skip to content
This repository was archived by the owner on Nov 4, 2026. It is now read-only.
This repository was archived by the owner on Nov 4, 2026. It is now read-only.

ObjectMap 把 schema.filter 当地图配置的容器读(getMapConfig 读 filter.map / filter.map.style):filter 是过滤器,不是配置槽 #4034

Closed

Description

@os-zhuang

Migrated from objectstack-ai/objectstack#7138 under the file-at-destination ruling (objectstack-ai/objectstack#7167, maintainer 2026-08-10). Originally filed 2026-08-09T20:34:18Z. The full prior thread — including triage rulings and hold/restart conditions — remains on the source issue and MUST be read before acting on this card.


发现于 objectstack#7121 的实施过程(objectui 分支 claude/issue-7121-datasource-remaining-blocks,基线 5bfaabde0)。观察类:今天没有用户会踩到(它要求作者用一个未文档化的 legacy 形状),但它是一处「宽容消费者」缺陷,而且与刚接上的 per-element 绑定有明确的相互作用,所以按 Prime Directive #10 如实记录。

事实

packages/plugin-map/src/ObjectMap.tsx 的 getMapConfig():

const style: string | undefined =
  (schema as any).style || (schema as any).mapStyle
  || (schema.filter as any)?.map?.style || (schema as any).map?.style;   // ← 第 143-145 行

// …
if (schema.filter && typeof schema.filter === 'object' && 'map' in schema.filter) {
  config = (schema.filter as any).map as MapConfig;                      // ← 第 163-164 行
}

即:任何 filter 对象都会被探一次 map 键,命中就把它当地图配置(经纬度字段、标题字段、zoom、style)使用。

而 filter 在同一个组件里的另一个身份是查询过滤器(第 412-414 行 $filter: schema.filter),object-map 注册处声明的配置输入是 { name: 'map', type: 'object' } —— 也就是说规范的书写位置是 schema.map,filter.map 是一条早于该 input 的遗留读法。

为什么现在记录

objectstack#7121 把 dataSource 绑定接到了 object-map,filter 是它映射的键之一(该块确有 $filter 读点)。于是:

  • 绑定/view 带来的 filter 与作者写的 schema.filter 会经 mergeFilterNodes 合成成 and 节点 → 合成后的对象上没有 map 键 → 用 legacy 形状写地图配置的页面会静默回落到默认地图配置(默认经纬度字段名),标记全部消失。
  • 没有发生合成时(只有作者自己的 filter,或压根没有 filter),schema.filter 原样透传,legacy 读法照旧生效 —— 所以这不是回归,是两条本就互斥的语义第一次撞上。

objectstack-ai/objectstack#7121 已在映射旁把这条注意写进注释,并不依赖 legacy 形状;这里只登记根因。

建议范围

把 getMapConfig 里读 schema.filter.map / schema.filter.map.style 的两处删掉,只保留声明过的 schema.map(及顶层 locationField/latitudeField 那一支与 style/mapStyle)。若仓外仍有 legacy 页面,先做一轮 grep;真需要过渡就在删除前加一条明确的 deprecation 警告,而不是继续无声接受 —— 「声明的是 map、消费的是 filter.map」正是 AI 生成的 metadata 最容易分叉的地方。

顺带:同文件对 filter 的这种重载会让「filter 到底是什么」在一个 block 内有两种答案,契约优先的方向是消费端不再宽容,由 producer/schema 负责。

Activity

  1. self-assigned this
    on Aug 11, 2026
  2. yinlianghui commented on Aug 11, 2026

    @yinlianghui
    Contributor

    CLAIM — session session_017Qqyix2QcnpUC9XeYVDzx3(objectui whole-repo PM seat),dispatching now。Branch: claude/issue-4034-objectmap-filter-config。

    按源线程(objectstack#7138)分诊裁决执行:restore-invariant(只消费声明过的 schema.map),删 ObjectMap.tsx 两处 legacy 读(:163-164 的 config 探测 + :145 的 filter.map.style 半支,同删)。Dispatch guard 原样传达:删除前 grep 全仓 + examples/ + showcase fixtures 找 filter: { map: 形状——命中活用法即停,回报而不是静默破坏(届时 deprecation 路线需另裁)。附加要求:红先 pin(legacy 形状不再被消费——写着 filter.map 的 schema 落默认地图配置并在 dev 模式给一条明确警告而非无声;schema.map 声明形状照常生效为对照),避免"删了读法但没人知道为什么标记消失"的静默留存。

    Surface:packages/plugin-map/src/ObjectMap.tsx + 测试;plugin-map 自 #4270 落地后无在飞持有者。


    Generated by Claude Code

  3. yinlianghui commented on Aug 11, 2026

    @yinlianghui
    Contributor

    ACCEPT — PM review of record (session session_017Qqyix2QcnpUC9XeYVDzx3)。

    PR #4331 验收要点:

    • 测量把卡片从 observation 升级成活缺陷,且是本卡最有价值的产出:'map' in schema.filter 走原型链,普通 filter 是数组,每个数组都继承 Array.prototype.map ⇒ 探测对任何数组形 filter 命中、把继承的函数赋作 MapConfig(spread 结果 {}),声明的 schema.map 落在不可达的 else 分支。两个已声明、已文档化输入(map + filter)同时书写 ⇒ 零标记 + 坐标无效横幅——不需要任何 legacy 形状。同时修正了 finding(app-shell): the Interfaces pillar offers Design mode and a "click a block" rail on leaves that have no block canvas — measured with a POPULATED registry #7121 预测机制(合并 and 节点也是数组 ⇒ 原型命中 ⇒ 空配置而非默认配置,同果异因)。原定级"无用户可踩"被实测证伪,fix 恰好同一删除。
    • Dispatch guard 执行完整:四种拼写跨双仓 grep 零活用法(三个无关命中逐一排除),catalog fixtures 全部规范书写,文档从未记载 legacy 形状——删除无外溢。
    • 警告 rider 落地讲究:镜像 objectui: metadata-admin 谓词求值器把 == 右侧的路径当字符串字面量,data.a == data.b 恒假且无诊断 #4049/DashboardGridLayout 的防御性 dev 门(globalThis.process?.env? 形式,纯浏览器 bundle 安全)+ warn-once memo(每渲染都跑的函数,洪水警告=静音警告)+ 触发刻意收窄(own property 且对象值——继承的 map 方法不触发、filter: {map: 'x'} 读作对字段 map 的过滤)。零新日志方言。
    • 红先 7/6 与预言精确;$filter 三种形状原样透传的对照钉住"修配置不动过滤";合并节点测试把 hasOwnProperty vs in 的机制本身钉死。CI 20 项收敛零失败。

    Flipping ready + auto-merge。


    Generated by Claude Code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions