Skip to content

refactor(presence): Create branded JsonDeserialized type #24641

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

tylerbutler
Copy link
Member

Updates the presence internals to use a branded internal type when passing around JsonDeserialized objects. There are two functions to brand and unbrand a JsonDeserialized object.

Externally, the API remains the same; the internal types and functions are marked @system and objects are converted between the types at the API boundaries.

@github-actions github-actions bot added area: framework Framework is a tag for issues involving the developer framework. Eg Aqueduct public api change Changes to a public API base: main PRs targeted against main branch labels May 15, 2025
@tylerbutler tylerbutler changed the title typebrand the JsonDeserialized type refactor(presence): Create branded JsonDeserialized type May 15, 2025
* @system
*/
export declare class JsonDeserializedBrand<T> {
private readonly JsonDeserialized: JsonDeserialized<T>;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can probably drop the JsonDeserialized<T>. Just T is probably enough. Probably want to use the dummy accessor and iterator found in that reference PR's brand classes.

Comment on lines 274 to 275
const unbrandedValue = fromJsonDeserializedHandle(item.value);
callbackfn(asDeeplyReadonly(unbrandedValue), key, this);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can probably combine both of these pass-through helper functions.

Comment on lines 280 to 281
const data = this.value.items[key]?.value;
return data === undefined ? undefined : asDeeplyReadonly(fromJsonDeserializedHandle(data));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Kind of silly since those are both pass through anyway - should be able to adjust the helper to handle it.

Copy link
Contributor

🔗 No broken links found! ✅

Your attention to detail is admirable.

linkcheck output


> [email protected] ci:check-links /home/runner/work/FluidFramework/FluidFramework/docs
> start-server-and-test "npm run serve -- --no-open" 3000 check-links

1: starting server using command "npm run serve -- --no-open"
and when url "[ 'http://127.0.0.1:3000' ]" is responding with HTTP status code 200
running tests using command "npm run check-links"


> [email protected] serve
> docusaurus serve --no-open

[SUCCESS] Serving "build" directory at: http://localhost:3000/

> [email protected] check-links
> linkcheck http://localhost:3000 --skip-file skipped-urls.txt

Crawling...

Stats:
  210260 links
    1663 destination URLs
    1895 URLs ignored
       0 warnings
       0 errors


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: framework Framework is a tag for issues involving the developer framework. Eg Aqueduct base: main PRs targeted against main branch public api change Changes to a public API
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants