Skip to content

"Loader commit was called but there is no staged data" warning is logged for loader known errors #675

@romansp

Description

@romansp

I followed the steps in the docs on Error Handling and added error: [KnownError] to my basic loader. When KnownError is thrown from data loader it's correctly captured and set as the error of data loader result.

But I also noticed that the following warning is being logged each time known error is thrown. Warning is only logged in development.

Loader "undefined"'s "commit()" was called but there is no staged data.

commit	@	basic.js:87
(anonymous)	@	index.js:95
(anonymous)	@	vue-router.mjs:3475
runWithContext	@	runtime-core.esm-bundler.js:4024
runWithContext	@	vue-router.mjs:3387
(anonymous)	@	vue-router.mjs:3475
triggerAfterEach	@	vue-router.mjs:3475
(anonymous)	@	vue-router.mjs:3370
Promise.then		
pushWithRedirect	@	vue-router.mjs:3335
push	@	vue-router.mjs:3260
navigate	@	vue-router.mjs:2315
callWithErrorHandling	@	runtime-core.esm-bundler.js:199
callWithAsyncErrorHandling	@	runtime-core.esm-bundler.js:206
invoker	@	runtime-dom.esm-bundler.js:730

Everything seems to be working well but wasn't sure if this warning is relevant or can be safely ignored?

Minimal repro: https://github.com/romansp/uvr-data-loader-known-errors

Repro steps

  1. Clone the repo.
  2. pnpm install
  3. pnpm run dev
  4. Go to the app.
  5. Open browser console.
  6. Click the links below to trigger navigation and load data.

Expected
Clicking "Load data with known error" should display KnownError on the page. No warning in the console.

Actual
Clicking "Load data with known error" logs a warning in the console.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions