File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77
88## [ Unreleased]
99
10+ ### Fixed
11+
12+ - Entities spawned during component deserialization now also get the ` Remote ` marker.
13+
1014## [ 0.39.1] - 2026-03-09
1115
1216### Fixed
Original file line number Diff line number Diff line change @@ -537,7 +537,13 @@ fn apply_changes(
537537 return Ok ( ( ) ) ;
538538 } ;
539539
540- DeferredEntity :: new ( client_entity, params. changes )
540+ let mut client_entity = DeferredEntity :: new ( client_entity, params. changes ) ;
541+ if !client_entity. contains :: < Remote > ( ) {
542+ // Even though the entity already exists, it could have been spawned during
543+ // deserialization of another component and doesn't have the marker yet.
544+ client_entity. insert ( Remote ) ;
545+ }
546+ client_entity
541547 }
542548 EntityEntry :: Vacant ( entry) => {
543549 let mut client_entity = DeferredEntity :: new ( world. spawn_empty ( ) , params. changes ) ;
Original file line number Diff line number Diff line change @@ -149,6 +149,40 @@ fn old_component() {
149149 assert_eq ! ( components. iter( client_app. world( ) ) . count( ) , 1 ) ;
150150}
151151
152+ #[ test]
153+ fn related ( ) {
154+ let mut server_app = App :: new ( ) ;
155+ let mut client_app = App :: new ( ) ;
156+
157+ for app in [ & mut server_app, & mut client_app] {
158+ app. add_plugins ( (
159+ MinimalPlugins ,
160+ StatesPlugin ,
161+ RepliconPlugins . set ( ServerPlugin :: new ( PostUpdate ) ) ,
162+ ) )
163+ . replicate :: < ChildOf > ( )
164+ . finish ( ) ;
165+ }
166+
167+ server_app. connect_client ( & mut client_app) ;
168+
169+ let server_parent = server_app. world_mut ( ) . spawn ( Replicated ) . id ( ) ;
170+ server_app
171+ . world_mut ( )
172+ . spawn ( ( Replicated , ChildOf ( server_parent) ) ) ;
173+
174+ server_app. update ( ) ;
175+ server_app. exchange_with_client ( & mut client_app) ;
176+ client_app. update ( ) ;
177+ server_app. exchange_with_client ( & mut client_app) ;
178+
179+ let mut children = client_app. world_mut ( ) . query :: < & ChildOf > ( ) ;
180+ assert_eq ! ( children. iter( client_app. world( ) ) . len( ) , 1 ) ;
181+
182+ let mut remote = client_app. world_mut ( ) . query :: < & Remote > ( ) ;
183+ assert_eq ! ( remote. iter( client_app. world( ) ) . len( ) , 2 ) ;
184+ }
185+
152186#[ test]
153187fn empty_before_connection ( ) {
154188 let mut server_app = App :: new ( ) ;
You can’t perform that action at this time.
0 commit comments