Using createAsync in SolidJS: Handling Data Dependencies
Currently, I'm thinking of two approaches:
Unified Loader Pattern:
Separate Async Queries Pattern (commented out):
My key questions are:
Data Loading Strategy
Is it better to use a unified loader that fetches all related data in one query (similar to Remix's loader pattern), or should we use separate createAsync calls for each data dependency?
Dynamic Data Updates
How should we handle dynamic updates when a program is selected? Currently, the form has this select handler:
But changing the program doesn't update the variants because they're loaded once through the unified loader.
Dependency Management
The
Potential solutions:
- Keep the loader for initial data but add a separate action/query for variant updates
- Return to separate createAsync calls with proper dependency tracking
- Implement a hybrid approach
What's the most idiomatic way to handle this in SolidJS, considering both initial load and dynamic updates?
Unified Loader Pattern:
Separate Async Queries Pattern (commented out):
My key questions are:
Data Loading Strategy
Is it better to use a unified loader that fetches all related data in one query (similar to Remix's loader pattern), or should we use separate createAsync calls for each data dependency?
Dynamic Data Updates
How should we handle dynamic updates when a program is selected? Currently, the form has this select handler:
But changing the program doesn't update the variants because they're loaded once through the unified loader.
Dependency Management
The
variants depend on the selected programId. The current loader handles this initial dependency well, but doesn't account for dynamic updates.Potential solutions:
- Keep the loader for initial data but add a separate action/query for variant updates
- Return to separate createAsync calls with proper dependency tracking
- Implement a hybrid approach
What's the most idiomatic way to handle this in SolidJS, considering both initial load and dynamic updates?
