Replies: 1 comment 16 replies
-
There has been some talk in the core-team about fractal FSD structure, but none of it has been released yet. As for your proposal, my main question is: why do we need this? Layer names have semantic meaning, so when we consider the term "FSD Widget", we expect to find all of them in I think that the main struggle that this proposal is trying to address is how to organize a lot of code within a single slice. It's a very valid struggle, but addressing it properly would probably require some examples of complex logic inside a slice when a simple division by segments is no longer enough. Could you come up with some example that illustrates the benefits of this proposal over the existing structure? |
Beta Was this translation helpful? Give feedback.
-
The main idea is allowing the same layers structure but within a slice. If some slice (let it be some page for example) has it's own UNIQ business logic we can use the same FSD approach to structurize that logic within a slice folder i.e we can place "features" and "widgets" folders alogside with model/api/ui within that page slice. The rules are exactly the same as for root layers: only one direction relations. Layers within a slice could ONLY start with the layer below the slice layer, i.e if a slice is an instance of pages it's own layers could start with widgets, if a slice is instance of widgets then it's own layers could start from features, etc. This will allow to limit nesting structure by layers depth and nesting will be finite. There is no violation in case if some nested feature imports some "global feature layer" feature, because nested feature relates to it's higher slice, there couldn't be cross imports issues. Possibly it's better to place nested layers within a "model" folder.
Nested structure example
Beta Was this translation helpful? Give feedback.
All reactions