You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Update the existing hero fallback logic so that a successful Directus response with no Published heroes does not fall back to static hero data.
Why improve it?**: Hero status gating introduced in Status gating for heroes #629 ensures that only heroes with status = Published are returned from Directus. However, some existing hero views and helpers fall back to static hero data when Directus returns an empty result. In edge cases, this can make Draft or Archived heroes publicly visible again and effectively bypass the status gating.
🌟 Benefits of the Enhancement
Prevents unfinished or archived hero content from appearing publicly when it should be hidden.
Keeps the new status workflow reliable and makes a clear distinction between a valid empty Directus response and an actual Directus request failure. This also makes the fallback behavior easier to reason about and maintain.
🛠️ Proposed Implementation
Technical Details:
Treat a successful Directus response with no Published heroes as a valid result.
Do not use static hero data when the Directus request succeeds but returns an empty list or no matching Published hero.
Keep static fallback only for actual Directus failures or unavailable Directus, if fallback behavior is still desired.
Review the existing fallback logic in:
HeroManager.getHeroBySlugAsync()
HeroManager.getAllHeroesFromDirectus()
Defense gallery views using useGetHeroGroupsQuery()
Hero detail page loading and navigation
Implementation Plan:
Separate successful empty responses from failed Directus requests.
Prevent undefined / empty Published results from automatically falling back to static hero data.
Ensure a Draft or Archived hero accessed directly by slug results in NotFound instead of static fallback.
Ensure gallery/group views stay empty when Directus successfully returns no Published heroes.
✨ Enhancement Description
status = Publishedare returned from Directus. However, some existing hero views and helpers fall back to static hero data when Directus returns an empty result. In edge cases, this can make Draft or Archived heroes publicly visible again and effectively bypass the status gating.🌟 Benefits of the Enhancement
🛠️ Proposed Implementation
Technical Details:
Treat a successful Directus response with no Published heroes as a valid result.
Do not use static hero data when the Directus request succeeds but returns an empty list or no matching Published hero.
Keep static fallback only for actual Directus failures or unavailable Directus, if fallback behavior is still desired.
Review the existing fallback logic in:
HeroManager.getHeroBySlugAsync()HeroManager.getAllHeroesFromDirectus()useGetHeroGroupsQuery()Implementation Plan:
undefined/ empty Published results from automatically falling back to static hero data.📎 Additional Information
Links & References:
Mockups/Examples:
Example edge case:
DraftorArchived.The desired behavior is that a successful empty Directus response remains empty, while static fallback is only used for actual Directus failures.