Skip to content

Commit

Permalink
fix: remove wrong error log during HMR
Browse files Browse the repository at this point in the history
During dev if you edit a component that exports a loader, it will
automatically trigger without the navigation. It will therefore have no
entry. The loader should account for this and still work.
  • Loading branch information
posva committed May 23, 2024
1 parent 8b3e1f0 commit c511082
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 16 deletions.
8 changes: 0 additions & 8 deletions src/data-loaders/defineColadaLoader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -339,14 +339,6 @@ export function defineColadaLoader<Data, isLazy extends boolean>(
>
let entry = entries.get(loader)

if (process.env.NODE_ENV === 'development') {
if (!parentEntry && !entry) {
console.error(
`Some "useDataLoader()" was called outside of a component's setup or a data loader.`
)
}
}

if (
// if the entry doesn't exist, create it with load and ensure it's loading
!entry ||
Expand Down
8 changes: 0 additions & 8 deletions src/data-loaders/defineLoader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -294,14 +294,6 @@ export function defineBasicLoader<Data, isLazy extends boolean>(
// console.log('is same route', entry?.pendingTo === route)
// console.log('-- END --')

if (process.env.NODE_ENV === 'development') {
if (!parentEntry && !entry) {
console.error(
`Some "useDataLoader()" was called outside of a component's setup or a data loader.`
)
}
}

if (
// if the entry doesn't exist, create it with load and ensure it's loading
!entry ||
Expand Down

0 comments on commit c511082

Please sign in to comment.