Datasets depend on each other in a loop

Two or more datasets wait for each other, so Bevel cannot pick a load order.

  • Error
  • BEVEL011

What it means

Dataset A depends on B and B depends on A, directly or through others. Bevel loads datasets in dependency order, so a loop has no first step. The error lists each cycle, like Posts -> Tags -> Posts.

Example message

text
Data/Posts/BlogPost.cs(6,15): error BEVEL011: Circular dataset dependency among: Posts, Tags. Cycles: Posts -> Tags -> Posts. Break the cycle by: extracting the shared data into a new dataset both can depend on; inverting the dependency so only one side reads the other; merging the loaders into one; or computing the derived value in the Razor component instead. Help: https://khalidabuhakmeh.github.io/bevel/reference/diagnostics/bevel011/

How to fix

Break the loop with one of these:

  1. Move the shared data into a third dataset both can depend on.
  2. Flip one dependency so only one side reads the other.
  3. Merge the two loaders into one.
  4. Compute the value in your Razor component instead.