Skip to content

Commit

Permalink
add props to tag
Browse files Browse the repository at this point in the history
  • Loading branch information
patricklx committed Jun 12, 2024
1 parent 2206e8a commit 6432fe4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
10 changes: 3 additions & 7 deletions packages/@glimmer/validator/lib/meta.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import type { ConstantTag, Tag, UpdatableTag } from '@glimmer/interfaces';

import type { Indexable } from './utils';
import type { MonomorphicTagImpl } from './validators';

import { debug } from './debug';
import { unwrap } from './utils';
Expand All @@ -15,7 +16,6 @@ function isObjectLike<T>(u: T): u is Indexable & T {
export type TagMeta = Map<PropertyKey, UpdatableTag>;

const TRACKED_TAGS = new WeakMap<object, TagMeta>();
const TAG_META = Symbol('TAG_META');

export function dirtyTagFor<T extends object>(
obj: T,
Expand Down Expand Up @@ -65,17 +65,13 @@ export function tagFor<T extends object>(

if (tag === undefined) {
tag = createUpdatableTag();
(tag as MonomorphicTagImpl).meta = { propertyKey: key, object: obj };
tags.set(key, tag);

(tag as any)[TAG_META] = {
propertyKey: key,
object: obj,
};
}

return tag;
}

export function infoForTag(tag: Tag) {
return (tag as any)[TAG_META];
return (tag as MonomorphicTagImpl).meta;
}
1 change: 1 addition & 0 deletions packages/@glimmer/validator/lib/validators.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ export class MonomorphicTagImpl<T extends MonomorphicTagId = MonomorphicTagId> {
private isUpdating = false;
public subtag: Tag | Tag[] | null = null;
private subtagBufferCache: Revision | null = null;
public meta: any = null;

[TYPE]: T;

Expand Down

0 comments on commit 6432fe4

Please sign in to comment.