mirror of
https://github.com/go-admin-team/go-admin.git
synced 2026-09-30 12:51:25 +00:00
Every $hasX flag controlling an optional import matched "this column carries the metadata" rather than "some rendered branch actually reads it" -- necessary but not sufficient, since FkTableName/DictType lose to each other by priority (FK wins search, list and the form's select branch; the form's radio branch never checks FK at all) and a column can carry either while being neither queryable, listed, nor an insertable select/radio. $hasDatetime was the reachable case integration testing found: sys_tables.go assigns HtmlType "datetime" to any timestamp/datetime column on import regardless of IsList, because GetList's audit-column exclusion is a separate, later step editTable.vue never surfaces created_at/updated_at through anyway. Nearly every real table has both, so nearly every table imported DateCell without using it. $hasFk and $hasDict had the identical shape one level down: the per-column ref/onMounted/useDict declarations were gated on "this column has FkTableName/DictType", not on whether the column reaches a branch that reads the resulting Options ref -- an FK column used only via search (no IsList, no insert-select) still declared a Label function nothing calls, and a dict column used only in an insert radio (no IsQuery, no IsList) still would have, had the two flags controlling its import stayed as wide as the per-column check they were meant to gate. Rewrote both to a shared $dictUsed/$fkUsed condition, matching each consuming branch's own guard term for term, and split the FK block's Label function under its own IsList check -- Options can be needed for search or the form's select without List ever being true. $hasDictList already had this shape from the previous fix and needed no change. Verified with two new fixtures, rendered through the real template.Execute and checked against a throwaway go-admin-ui worktree (deleted afterwards) with hand-written API-module stubs: a bare table carrying only the standard created_at/updated_at pair -- confirmed red on DateCell before this change, green after -- and a table exercising every optional import through a path distinct from the ones the two earlier verification rounds covered (a dict column read only from an insert radio, an FK column read only from search, and a business datetime column that IS listed, so DateCell still has to import when the real thing needs it). Re-ran the three fixtures from the previous two rounds alongside these two; all five stayed green. pnpm type-check and pnpm lint both zero error, on Node 24.11.0.