Add tag() action for CollectionService tags#76
Open
BitwiseAndrea wants to merge 1 commit into
Open
Conversation
Adds a built-in `vide.tag()` action that wraps `Instance:AddTag()` / `Instance:RemoveTag()` so tags can be applied through `create()` props. It accepts a static string or array of strings, or a reactive source returning either. The reactive variant diffs the previous and new tag sets so only the delta is applied. All tags added by the action are removed when the surrounding scope is destroyed. Includes mock support for `AddTag`/`RemoveTag`/`HasTag`/`GetTags`, tests, API reference docs, and a closing note in the actions tutorial. Co-authored-by: Cursor <cursoragent@cursor.com>
|
Just repeating what Centau said from another PR |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a built-in
vide.tag()action that wrapsInstance:AddTag()/Instance:RemoveTag()so CollectionService tags can be applied directly throughcreate()props, alongside the existingchanged()helper.string, a{ string }, or a reactive source returning either.cleanup).tag()actions compose on the same instance.changed().Loosely modeled after react-luau's
Taghandling, but exposed as an action to fit Vide's existing patterns (rather than a magic prop key). Uses the newerInstance:AddTag/RemoveTagmethods directly rather than going throughCollectionService.Changes
src/tag.luau— new action implementation.src/lib.luau— exportsvide.tag.test/mock.luau— addsAddTag/RemoveTag/HasTag/GetTagsto the mockInstanceso the action is testable outside Studio.test/tests.luau— 8 new cases covering single/multi/static/reactive tags, scope-destroy cleanup, and composition.docs/api/creation.md— newtag()API reference section.docs/tut/crash-course/12-actions.md— closing note pointing readers at the built-inchanged()andtag()helpers.CHANGELOG.md— entry under Unreleased / Added.Test plan
luau test/tests.luau— 130/130 cases pass, including the 8 newtag()cases.Instance(Add/Remove/Has/GetTag).Made with Cursor