Varkopat/enhancement/682 629 follow up prevent static hero fallback from bypassing status gating - #684
Conversation
Successful empty Directus responses now remain empty, while static data is used only for actual request failures or unavailable Directus. Updated manager logic, hero detail routes, gallery/group views, navigation, and client detail loading. Added regression tests covering empty responses and failure fallback in heroApi.test.ts and HeroManager.test.ts. Validation: - Focused Jest tests: 9 passed - git diff --check: passed - TypeScript check: only existing unrelated test errors remain.
patinen
left a comment
There was a problem hiding this comment.
Nice job overall. The page seems to be working now as expected.
One thing still needs fixing however:
frontend-next-migration/src/app/[lng]/(helper)/defense-gallery/[herogroup]/_getPage.ts still falls back to static hero data when Directus returns a successful but empty result:
if (Object.keys(groups).length === 0) {
groups = initializeHeroGroups(t);
}
This still bypasses the intended behavior, which menas a successful empty response is still treated as a reason to use static hero data on the server side. The returned groups are also used building the page metadata/SEO, including the group description etc. So static hero data can still leak into the response even though the visible page itself is empty.
Other than this, the follow-up logic looks good to me.
Fixed defense-gallery/[herogroup]/_getPage.ts. Successful empty Directus responses now remain empty, including metadata/SEO generation. Static groups are used only when the Directus request throws. Validation passed: - Hero regression tests: 9 passed - Diagnostics: no errors in the touched route - git diff --check: passed
patinen
left a comment
There was a problem hiding this comment.
Awesome job! The remaining empty-response fallback has been removed, so successful empty Directus responses are no longer replaced with static data on the server side either.
Nice addition of the regression tests as well. Approved 👍
📄 Pull Request Overview
Closes #682
🔧 Changes Made
Successful empty Directus responses now remain empty, while static data is used only for actual request failures or unavailable Directus. Updated manager logic, hero detail routes, gallery/group views, navigation, and client detail loading.
Added regression tests covering empty responses and failure fallback in heroApi.test.ts and HeroManager.test.ts.
I also did the following validations:
Focused Jest tests: 9 passed
git diff --check: passed
✅ Checklist Before Submission
console.log()or other debugging statements are left.📝 Additional Information
Provide any additional context or information that reviewers may need to know:
The defense gallery page doesn't show any heroes if they all are set as Draft/Archived on Directus: