Make WordPress Core

Opened 4 weeks ago

Closed 4 weeks ago

Last modified 3 weeks ago

#62374 closed defect (bug) (fixed)

Missing state properties and negation operator behave differently client/server

Reported by: jonsurrell's profile jonsurrell Owned by: jonsurrell's profile jonsurrell
Milestone: 6.7.1 Priority: normal
Severity: normal Version: 6.5
Component: Interactivity API Keywords: has-patch commit has-unit-tests
Focuses: Cc:

Description

With a directive like the following:

<div data-wp-bind--hidden="!state.missing.property">
	This should be hidden by the <code>hidden</code> attribute.
</div>

The server will render the following HTML:

<div data-wp-bind--hidden="!state.missing.property">
	This should be hidden by the <code>hidden</code> attribute.
</div>

But the client will immediately set the hidden attribute (the expected behavior):

<div data-wp-bind--hidden="!state.missing.property" hidden="">
	This should be hidden by the <code>hidden</code> attribute.
</div>

The client and server should align on the behavior of the negation operator with directives to missing paths.

Change History (11)

This ticket was mentioned in PR #7755 on WordPress/wordpress-develop by @jonsurrell.


4 weeks ago
#1

  • Keywords has-patch added

Trac ticket: https://core.trac.wordpress.org/ticket/62374

With a directive like the following:

This should be hidden by the hidden attribute.

The server will render the following HTML:

This should be hidden by the hidden attribute.

But the client will immediately set the hidden attribute (the expected behavior):

This should be hidden by the hidden attribute.

The client and server should align on the behavior of the negation operator with directives to missing paths.

---

The client side implementation allows negation to happen when state is missing.

The server side implementation skipped a possible negation when state is missing.

#2 @jonsurrell
4 weeks ago

  • Milestone changed from Awaiting Review to 6.7.1

#3 @cbravobernal
4 weeks ago

  • Keywords commit added

#4 @gziolo
4 weeks ago

  • Keywords has-unit-tests added
  • Version set to 6.5

#5 @cbravobernal
4 weeks ago

  • Resolution set to fixed
  • Status changed from assigned to closed

In 59398:

Interactivity API: Allow missing state negation on server

Aligns on the behavior of the negation operator with directives to missing paths in client and in server.

With a directive like the following:

<div data-wp-bind--hidden="!state.missing.property">
	This should be hidden by the <code>hidden</code> attribute.
</div>

Both server and client will return with this fix:

<div data-wp-bind--hidden="!state.missing.property" hidden="">
	This should be hidden by the <code>hidden</code> attribute.
</div>

Props jonsurrell, luisherranz.
Fixes #62374.

#7 @cbravobernal
4 weeks ago

  • Keywords dev-feedback added
  • Resolution fixed deleted
  • Status changed from closed to reopened

Reporting for 2nd committer review and sign-off for backporting https://core.trac.wordpress.org/changeset/59398 to the 6.7 branch.

#8 @cbravobernal
4 weeks ago

  • Resolution set to fixed
  • Status changed from reopened to closed

In 59404:

Interactivity API: Allow missing state negation on server

Aligns on the behavior of the negation operator with directives to missing paths in client and in server.

With a directive like the following:

<div data-wp-bind--hidden="!state.missing.property">
	This should be hidden by the <code>hidden</code> attribute.
</div>

Both server and client will return with this fix:

<div data-wp-bind--hidden="!state.missing.property" hidden="">
	This should be hidden by the <code>hidden</code> attribute.
</div>

Reviewed by cbravobernal.
Merges [59398] to the 6.7 branch.

Props jonsurrell, luisherranz.
Fixes #62374.

#10 @cbravobernal
3 weeks ago

  • Keywords dev-feedback removed

#11 @desrosj
3 weeks ago

  • Summary changed from Interactivity API: Missing state properties and negation operator behave differently client/server to Missing state properties and negation operator behave differently client/server
Note: See TracTickets for help on using tickets.