Skip to content

Hooks are not reloaded when using overlays #11082

Closed

Description

@vladidobro

Describe the bug

It is not possible to set hooks in overlays using export-env.
$env.config.hooks is updated, but the hooks are not active.

How to reproduce

~> module hooks { export-env {$env.config.hooks.pre_prompt = [{|| print 1}]}}
~> overlay use hooks
~> # hook is not active
~> $env.config.hooks.pre_prompt  # shows that the hook is updated
...
~> $env.config = $env.config  # this reloads the hooks
1
~> # hook is now active

Expected behavior

I expect the hooks to be active immediately after updating $env.config, just like in REPL or with use

~> $env.config.hooks.pre_prompt = [{|| print 1}]
1
~>

or

~> use hooks
1
~>

Screenshots

No response

Configuration

key value
version 0.85.0
branch master
commit_hash
build_os macos-aarch64
build_target aarch64-apple-darwin
rust_version rustc 1.72.1 (d5c2e9c34 2023-09-13) (Homebrew)
cargo_version cargo 1.72.1
build_time 2023-09-19 18:42:47 +00:00
build_rust_channel release
allocator mimalloc
features dataframe, default, sqlite, trash, which, zip
installed_plugins

Additional context

Maybe there is a standard way to do this?

Activity

  1. added
    status:needs-triage
    on Nov 17, 2023
  2. fdncred commented on Nov 17, 2023

    @fdncred
    Contributor

    Do you get the same behavior in 0.87.0?

  3. vladidobro commented on Nov 17, 2023

    @vladidobro
    Author

    yes, with 0.87.0 it is the same

  4. fdncred commented on Nov 17, 2023

    @fdncred
    Contributor

    Any ideas @kubouch?

  5. added
    category:bug
    A:configuration
    status:needs-triage
    A:hooks
    and removed
    status:needs-triage
    on Nov 17, 2023
  6. kubouch commented on Nov 17, 2023

    @kubouch
    Contributor

    Potentially related issues: #7760 #10592 #8856

    I think they all might have the same cause, which is that we have one Config in the EngineState, but we'd need a Config for each overlay. Or better, do not have the Config struct at all and use only Nushell's environment to handle config values.

  7. added this to the v0.106.0 milestone on Jul 13, 2025
  8. added a commit that references this issue on Jul 13, 2025
    60ca889
  9. added a commit that references this issue on Aug 25, 2025
    8021f98
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    A:configurationA:hookscategory:bug

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions