Skip to content

useBlocker must be used within a data router.Β #14525

@leemason

Description

@leemason

Reproduction

i understand the requirements, howeveer this is a module federation setup that will be difficult to reproduce. im trying to understand the router context as clearly in this example its not being translated over module federation boundaries.

I am trying to use useBlocker, i am using a data router in the host via createBrowserRouter and its the only router instance in use. when i try and use useBlocker inside a component from an mfe i get the must be used with a data router error.

as you can see below its clearly a data router in use:

Image

and the error boundary is firing with the error message its not in a data router.

System Info

System:
    OS: Windows 11 10.0.26200
    CPU: (8) x64 Intel(R) Xeon(R) Platinum 8370C CPU @ 2.80GHz
    Memory: 15.87 GB / 31.95 GB
  Binaries:
    Node: 22.14.0 - C:\nvm4w\nodejs\node.EXE
    Yarn: 1.22.22 - C:\nvm4w\nodejs\yarn.CMD
    npm: 10.9.2 - C:\nvm4w\nodejs\npm.CMD
    pnpm: 10.21.0 - C:\nvm4w\nodejs\pnpm.CMD
  Browsers:
    Chrome: 141.0.7390.123
    Edge: Chromium (141.0.3537.99)
    Firefox: 131.0.2 - C:\Program Files\Mozilla Firefox\firefox.exe
    Internet Explorer: 11.0.26100.1882

Used Package Manager

yarn

Expected Behavior

using useBlocker via a mfe component should be possible inside a data router

Actual Behavior

error is thrown that it is not inside a data router.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions