[CORRUPTED] Synthetic Benchmark PR #30102 - fix(web): remove incorrect placeholderData usage in useExploreAppList#125
Open
ofir-frd wants to merge 4 commits intobase_pr_30102_20260108_6051from
Conversation
The placeholderData option was being used with empty arrays to simulate loading state, which is an anti-pattern in TanStack Query. According to the official TanStack Query documentation: - placeholderData is for displaying temporary data during pending state - It should not be used with empty data to mock loading - isLoading should be used to control initial loading state instead Changes: - Remove exploreAppListInitialData and placeholderData from useExploreAppList - Use isLoading to properly control loading state in components - Update both explore/app-list and create-app-dialog/app-list components - Remove unused PageType enum to fix fast refresh warning This aligns with TanStack Query best practices and properly distinguishes between "loading" and "empty data" states.
Updated the explore app list component to properly handle loading and error states. The loading state is now controlled by the isLoading flag, and the component will return null if there is an error or no data available. Additionally, adjusted the mock data in tests to reflect these changes, ensuring accurate simulation of loading and error scenarios. Changes: - Refactored loading condition to use isLoading - Added error handling to return null when isError is true - Updated tests to align with new loading and error handling logic
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Benchmark PR langgenius#30102
Type: Corrupted (contains bugs)
Original PR Title: fix(web): remove incorrect placeholderData usage in useExploreAppList
Original PR Description: ## Summary
Fixes incorrect
placeholderDatausage inuseExploreAppListthat was introduced in PR langgenius#30076.Background
PR langgenius#30076 migrated the Explore app list from useSWR to TanStack Query, but used
placeholderData: exploreAppListInitialData(empty arrays) to simulate the loading state. This is an anti-pattern according to TanStack Query's official documentation.Problem
According to TanStack Query docs:
The previous implementation had these issues:
placeholderData,datais neverundefined, soisLoadingis alwaysfalseSolution
Remove
placeholderDataand use the properisLoadingstate to control loading:Before:
After:
Changes
exploreAppListInitialDataexport andplaceholderDataoptionisLoadingfor loading state, remove unusedPageTypeenumisLoadingfor loading stateTesting
pnpm lint:fix- Passespnpm type-check:tsgo- PassesReferences
Original PR URL: fix(web): remove incorrect placeholderData usage in useExploreAppList langgenius/dify#30102
Compliance Violation