[wp-trac] [WordPress Trac] #61037: Interactivity API: Directives cannot derive state on the server

WordPress Trac noreply at wordpress.org
Thu Apr 18 11:12:59 UTC 2024


#61037: Interactivity API: Directives cannot derive state on the server
-----------------------------+-----------------------------
 Reporter:  jonsurrell       |      Owner:  jonsurrell
     Type:  feature request  |     Status:  assigned
 Priority:  normal           |  Milestone:  Awaiting Review
Component:  General          |    Version:
 Severity:  normal           |   Keywords:
  Focuses:  javascript       |
-----------------------------+-----------------------------
 The Interactivity API [https://developer.wordpress.org/block-editor
 /reference-guides/packages/packages-interactivity/packages-interactivity-
 api-reference/#elements-of-the-store has a concept of "derived state"] but
 it only works on the client (JavaScript). There is no analogous on the
 server, so derived state does not have a good server-side solution.

 The client side implementation uses getter functions.

 There are some workarounds on the server such as calling
 `wp_interactivity_state` to set the "derived" value in state. There are
 some situations, such as in a `wp-each` directive, where it appears there
 is no way to use derived state on the server and always fallback to
 client-side rendering.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/61037>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list