Skip to content

feat: update extended client:visible to use an object instead of a string#9596

Merged
Princesseuh merged 6 commits intomainfrom
update/client-visible-options
Jan 4, 2024
Merged

feat: update extended client:visible to use an object instead of a string#9596
Princesseuh merged 6 commits intomainfrom
update/client-visible-options

Conversation

@Princesseuh
Copy link
Copy Markdown
Member

Changes

Revert #9363 and redo it using an object instead of a string, that way it can supports options we'll add in the future.

Testing

Tested manually, like the original PR.

Docs

Will update docs!

@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Jan 3, 2024

🦋 Changeset detected

Latest commit: 8cbb65d

The changes in this PR will be included in the next version bump.

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions github-actions bot added pkg: astro Related to the core `astro` package (scope) pr: docs A PR that includes documentation for review labels Jan 3, 2024
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Jan 3, 2024

⚖️ Bundle Size Check

Latest commit: 8cbb65d

File Old Size New Size Change
client:visible 271 B 301 B + 30 B

Copy link
Copy Markdown
Member

@natemoo-re natemoo-re left a comment

Choose a reason for hiding this comment

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

Looks good! Can we add a test that these arguments are properly encoded in the HTML?

Princesseuh and others added 2 commits January 3, 2024 14:03
Co-authored-by: Nate Moore <natemoo-re@users.noreply.github.com>
Copy link
Copy Markdown
Member

@natemoo-re natemoo-re left a comment

Choose a reason for hiding this comment

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

Nice test! Thank you!

const ioOptions = {
rootMargin: typeof options.value === 'string' ? options.value : undefined,
const rawOptions =
typeof options.value === 'object' ? (options.value as ClientVisibleOptions) : undefined;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Final nit: this technically adds support for all IntersectionObserverInit values, but our types are narrowed to only support Pick<IntersectionObserverInit, 'rootMargin'>. Is that desired?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

It doesn't, see the code below

@Princesseuh Princesseuh merged commit fbc2697 into main Jan 4, 2024
@Princesseuh Princesseuh deleted the update/client-visible-options branch January 4, 2024 00:44
@astrobot-houston astrobot-houston mentioned this pull request Jan 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pkg: astro Related to the core `astro` package (scope) pr: docs A PR that includes documentation for review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants