Skip to content

Commit

Permalink
Warn about client-side tags being dropped (#967)
Browse files Browse the repository at this point in the history
## Changes

This behavior can cause unexpected removal of tags added locally.

## Checks

By submitting your pull request for review, you agree to the following:

- [x] This contribution was created in whole or in part by me, and I
have the right to submit it under the terms of this repository's open
source licenses.
- [x] I understand and agree that this contribution and a record of it
are public, maintained indefinitely, and may be redistributed under the
terms of this repository's open source licenses.
- [x] To the best of my knowledge, all proposed changes are accurate.

---------
  • Loading branch information
Ketasaja authored Jan 6, 2025
1 parent 6320993 commit eaddbfe
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 5 deletions.
14 changes: 10 additions & 4 deletions content/en-us/reference/engine/classes/CollectionService.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,16 @@ methods:
signal created by `Class.CollectionService:GetInstanceAddedSignal()` with
the given tag.
**Warning:** When tagging an instance, it is common that some resources
are used to give the tag its functionality, e.g. event connections or
tables. To prevent memory leaks, it is a good idea to clean these up
(disconnect, set to nil, etc) when no longer needed for a tag. Do this
##### Warnings
- An instance's tags that were added client-side will be dropped if the server
later adds or removes a tag on that instance because the server replicates all
tags together and overwrites previous tags.
- When tagging an instance, it is common that some resources
are used to give the tag its functionality, for example event connections or
tables. To prevent memory leaks, it's a good idea to clean these up
(disconnect, set to `nil`, etc.) when no longer needed for a tag. Do this
when calling `Class.CollectionService:RemoveTag()`, calling
`Class.Instance:Destroy()` or in a function connected to a signal returned
by `Class.CollectionService:GetInstanceRemovedSignal()`.
Expand Down
8 changes: 7 additions & 1 deletion content/en-us/reference/engine/classes/Instance.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,13 @@ methods:
already applied. Successfully adding a tag will fire a signal created by
`Class.CollectionService:GetInstanceAddedSignal()` with the given tag.
Note that when tagging an instance, it's common that some resources are
##### Warnings
- An instance's tags that were added client-side will be dropped if the server
later adds or removes a tag on that instance because the server replicates
all tags together and overwrites previous tags.
- When tagging an instance, it is common that some resources are
used to give the tag its functionality, for example event connections or
tables. To prevent memory leaks, it's a good idea to clean these up
(disconnect, set to `nil`, etc.) when no longer needed for a tag. Do this
Expand Down

0 comments on commit eaddbfe

Please sign in to comment.