Skip to content

Unconditionally register a on-load hook - #635

Merged
hadley merged 1 commit into
mainfrom
always-register-hook
May 26, 2026
Merged

hadley merged 1 commit into
mainfrom
always-register-hook

Conversation

@hadley

@hadley hadley commented May 25, 2026

Copy link
Copy Markdown
Member

This handles the (admittedly rare) case where a user unloads then re-loads a package.

Spotted in #573

This handles the (admittedly rare) case where a user unloads then re-loads a package.

Spotted in #573
@hadley
hadley requested a review from t-kalinowski May 26, 2026 13:19

@t-kalinowski t-kalinowski left a comment

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.

I'm surprised we need this. If a package is reloading, isn't its .onLoad() hook running again already?

@hadley

hadley commented May 26, 2026

Copy link
Copy Markdown
Member Author

Right, but we're currently only setting that if the package isn't loaded. But I know we learned this lesson the hard way in rlang: https://github.com/r-lib/rlang/blob/b2e9594bdfc539c65370eb6be6208cc8637d356f/R/standalone-s3-register.R#L120

@hadley
hadley merged commit 0b0df75 into main May 26, 2026
13 checks passed
@hadley
hadley deleted the always-register-hook branch May 26, 2026 21:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants