Comments (2)
I'm having a similar issue, it seems to be a race condition with removing and reindexing:
When removing an entity from the world, some onRemoved
subscribers will try to do some cleanup and run a world.removeComponent
. This will reindex the removed component, adding it back to any buckets it was just removed from. Then world.remove
will finish and the entity will no longer be in the world bucket. so each loop of a system, when I pull something out of a query I have to check if the entity is still in the world and if not I remove it from the bucket.
There should be a way to skip reindexing entities that are being removed from the root world bucket
Otherwise the library has been very helpful =D
from miniplex.
I'm assuming these are two separate (even if similar sounding) issues -- would you be willing to provide a (failing) test case? I'd be happy to fix and improve these situations, but I need to better understand what's going on.
In the meantime, it sounds like a potential workaround for these issues would be to queue the follow-up work (like removing the second component) using queueMicrotask.
from miniplex.
Related Issues (20)
- `archetype.first`
- [Idea] Allow `World.add` to take a setup function as an optional second argument
- Offer bound `ECS.useEntities(world => bucket)` API
- `useCurrentEntity` should throw when not run inside an entity context
- <Entity> will destroy and re-create its entity on every rerender
- `Query` (for 2.0)
- Publish `@miniplex/bucket` as `bucketeer`
- Garbage collection for Archetypes HOT 3
- Offer a ref-based capture mechanism alongside the `<Component>`-based one
- Remove all mentions of "archetypes" from the documentation, refer to "queries" instead
- Apply new `onEntityAdded` listeners to entities that are already in the query
- Research how well Miniplex works with class instances as entities (!) HOT 1
- Support setting components directly on `<Entity>`
- Miniplex 2.0 Release Checklist HOT 1
- Accessing Entity Defined in Player Function from App.jsx File HOT 1
- Best way to represent multiple entities? HOT 2
- miniplex + rapier = 💔? HOT 2
- Serialization and rehydration HOT 1
- Compared to Bitecs.js's ECS architecture mode, does EC mode perform better?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from miniplex.