This PR was opened by the Changesets release GitHub action. When you're ready to do a release, you can merge this and the packages will be published to npm automatically. If you're not ready to do a release yet, that's fine, whenever you add more changesets to main, this PR will be updated.
⚠️⚠️⚠️⚠️⚠️⚠️
main is currently in pre mode so this branch has prereleases rather than normal releases. If you want to exit prereleases, run changeset pre exit on main.
⚠️⚠️⚠️⚠️⚠️⚠️
Releases
miniplex@2.0.0-next.20
Patch Changes
Updated dependencies [b01cf43]
Updated dependencies [6f44ee7]
Updated dependencies [26cedc6]
Updated dependencies [2bcec9b]
@miniplex/core@2.0.0-next.20
@miniplex/react@2.0.0-next.20
@miniplex/core@2.0.0-next.20
Patch Changes
b01cf43: You can now call update() on any derived bucket to make it reindex all of the entities containeed in the source bucket it's derived from.
6f44ee7: The former world.update function has been renamed to world.evaluate.
26cedc6: Added an update function to the World class that allows the user to update an entity. This is intended to complement the other two mutating functions (addComponent, removeComponent), simply to allow for the use of syntactic sugar (component constructor functions, entity factories, etc.) in a streamlined fashion:
/* With an object with changes */
world.update(entity, { age: entity.age + 1 })
/* With a function returning an object with changes */
const increaseAge = ({age}) => ({ age: age + 1 }
world.update(entity, increaseAge)
/* With a function that mutates the entity directly: */
const mutatingIncreaseAge = (entity) => entity.age++
world.update(entity, mutatingIncreaseAge)
The main job of the function is to re-index the updated entity against known derived buckets, and since in Miniplex you'll typically mutate entities directly, it can even be called with only an entity. All of the above are essentially equivalent to:
entity.age++
world.update(entity)
@miniplex/react@2.0.0-next.20
Patch Changes
2bcec9b: Breaking Change: Removed the as prop. Please use children instead:
/* A function component whose props signature matches the entity type */
const User = ({ name }: { name: string }) => <div>{name}</div>
/* Pass it directly into the `children` prop */
<Entity in={users} children={User} />
As a reminder, this sort of children prop support isn't new; Miniplex has always supported this form:
This PR was opened by the Changesets release GitHub action. When you're ready to do a release, you can merge this and the packages will be published to npm automatically. If you're not ready to do a release yet, that's fine, whenever you add more changesets to main, this PR will be updated.
⚠️⚠️⚠️⚠️⚠️⚠️
main
is currently in pre mode so this branch has prereleases rather than normal releases. If you want to exit prereleases, runchangeset pre exit
onmain
.⚠️⚠️⚠️⚠️⚠️⚠️
Releases
miniplex@2.0.0-next.20
Patch Changes
@miniplex/core@2.0.0-next.20
Patch Changes
update()
on any derived bucket to make it reindex all of the entities containeed in the source bucket it's derived from.world.update
function has been renamed toworld.evaluate
.26cedc6: Added an
update
function to theWorld
class that allows the user to update an entity. This is intended to complement the other two mutating functions (addComponent
,removeComponent
), simply to allow for the use of syntactic sugar (component constructor functions, entity factories, etc.) in a streamlined fashion:The main job of the function is to re-index the updated entity against known derived buckets, and since in Miniplex you'll typically mutate entities directly, it can even be called with only an entity. All of the above are essentially equivalent to:
@miniplex/react@2.0.0-next.20
Patch Changes
2bcec9b: Breaking Change: Removed the
as
prop. Please usechildren
instead:As a reminder, this sort of
children
prop support isn't new; Miniplex has always supported this form:Passing a
children
prop is just another way to pass children to a React component.