@@ -6415,54 +6415,13 @@ export function DataPillar({
64156415 // that does not parse must not be saveable, let alone publishable as the live
64166416 // field definition (objectui#4306).
64176417 //
6418- // The report is STAMPED with the selection it came from: it is the open
6419- // inspector's live verdict, and never reads as another selection's.
6418+ // The count is STAMPED with the selection it came from, so it expires by
6419+ // construction when the selection changes or the panel closes: an unmounted
6420+ // inspector can never retract its last verdict, and a host that waited for
6421+ // one would leave Save wedged shut with nothing on screen to fix.
64206422 const [ blockingReport , setBlockingReport ] = React . useState ( { key : '' , count : 0 } ) ;
64216423 const fieldSelKey = fieldSel ? `${ current ?. name ?? '' } :${ fieldSel . kind } :${ fieldSel . id } ` : '' ;
6422- // objectstack#27485 — the verdict belongs to the draft, not to the selection.
6423- // Expiring it with the selection released the hold the moment the inspector
6424- // closed (Escape, Close, another field, another tab) while the broken text
6425- // stayed in the draft, and the autosave sent it. So each field's last live
6426- // verdict is kept with the stamp of what it judged (`fieldCelStamp`, taken
6427- // while the inspector is open on it) and holds, with the inspector closed,
6428- // while the draft still carries that stamp: an edit to the text, the field's
6429- // removal or the object's next load ends it. Nothing is left shut with
6430- // nothing to fix: the held line names the field and its "Show me" opens it,
6431- // and the open inspector's live verdict always wins.
6432- const [ celVerdicts , setCelVerdicts ] = React . useState < Record < string , { field : string ; count : number ; stamp : string | null } > > ( { } ) ;
6433- const liveFieldReport = fieldSel ?. kind === 'field' && blockingReport . key === fieldSelKey ;
6434- const openFieldStamp = fieldSel ?. kind === 'field' ? fieldCelStamp ( objDraft , fieldSel . id ) : null ;
6435- React . useEffect ( ( ) => {
6436- if ( ! liveFieldReport || fieldSel === null ) return ;
6437- const kept = { field : fieldSel . id , count : blockingReport . count , stamp : openFieldStamp } ;
6438- setCelVerdicts ( ( prev ) => {
6439- const was = prev [ fieldSelKey ] ;
6440- if ( was && was . count === kept . count && was . stamp === kept . stamp ) return prev ;
6441- return { ...prev , [ fieldSelKey ] : kept } ;
6442- } ) ;
6443- } , [ liveFieldReport , fieldSel , fieldSelKey , blockingReport . count , openFieldStamp ] ) ;
6444- // The open object's fields whose verdict holds, and their summed count.
6445- const celHeldFields : string [ ] = [ ] ;
6446- let inspectorBlocking = 0 ;
6447- const celFieldPrefix = `${ current ?. name ?? '' } :field:` ;
6448- for ( const [ key , kept ] of Object . entries ( celVerdicts ) ) {
6449- if ( ! key . startsWith ( celFieldPrefix ) || key === fieldSelKey ) continue ;
6450- if ( kept . count > 0 && kept . stamp === fieldCelStamp ( objDraft , kept . field ) ) {
6451- celHeldFields . push ( kept . field ) ;
6452- inspectorBlocking += kept . count ;
6453- }
6454- }
6455- if ( blockingReport . key === fieldSelKey && blockingReport . count > 0 ) {
6456- if ( fieldSel ?. kind === 'field' ) celHeldFields . push ( fieldSel . id ) ;
6457- inspectorBlocking += blockingReport . count ;
6458- } else if ( fieldSelKey !== '' && ! liveFieldReport ) {
6459- // Opened, and its inspector has not reported yet: its kept verdict stands.
6460- const kept = celVerdicts [ fieldSelKey ] ;
6461- if ( kept && kept . count > 0 && kept . stamp === openFieldStamp ) {
6462- celHeldFields . push ( kept . field ) ;
6463- inspectorBlocking += kept . count ;
6464- }
6465- }
6424+ const inspectorBlocking = blockingReport . key === fieldSelKey ? blockingReport . count : 0 ;
64666425 // The pillar's PANEL family reports separately (objectui#4527): the
64676426 // validations, actions and settings panels all write through this same draft
64686427 // and own no Save of their own, so their CEL faults have to reach this
@@ -6732,8 +6691,6 @@ export function DataPillar({
67326691 setLoading ( true ) ;
67336692 setError ( null ) ;
67346693 setFieldSel ( null ) ;
6735- // objectstack#27485 — kept CEL verdicts judged the buffer this load replaces.
6736- setCelVerdicts ( { } ) ;
67376694 setDirty ( false ) ;
67386695 ( async ( ) => {
67396696 try {
@@ -7010,27 +6967,8 @@ export function DataPillar({
70106967 snapshot : objDraft ,
70116968 save : doSave ,
70126969 } ) ;
7013- // objectstack#27485 — an unsent edit the CEL verdict holds is named like an
7014- // incomplete one: the held line, the surface's Publish and the rail's
7015- // question all read it, so it outlives the inspector without going unseen.
7016- const celHeldField = celHeldFields [ 0 ] ?? null ;
7017- const celHeldLabel = React . useMemo ( ( ) => {
7018- if ( celHeldField === null ) return null ;
7019- const label = readFields ( objDraft . fields ) . entries . find ( ( e ) => e . name === celHeldField ) ?. def . label ;
7020- return typeof label === 'string' && label . trim ( ) !== '' ? label . trim ( ) : celHeldField ;
7021- } , [ celHeldField , objDraft . fields ] ) ;
7022- const objCelHeld = React . useMemo < StudioHeld | null > (
7023- ( ) =>
7024- dirty && celHeldField !== null && celHeldLabel !== null
7025- ? {
7026- clause : tFormat ( 'engine.studio.held.celInvalid' , locale , { field : celHeldLabel } ) ,
7027- target : { kind : 'field' , id : celHeldField } ,
7028- }
7029- : null ,
7030- [ dirty , celHeldField , celHeldLabel , locale ] ,
7031- ) ;
70326970 // Only the open object's own buffer is held (objectui#11272).
7033- const objHeld = objLoaded ? ( objIncomplete ?? objCelHeld ) : null ;
6971+ const objHeld = objLoaded ? objIncomplete : null ;
70346972 // objectstack#26917 — the refusal's way out: the object holding the
70356973 // identifier is on this rail, so it opens instead of a second one being
70366974 // made. The New button already asked about a held edit (objectstack#26845).
0 commit comments