Skip to content

Conversation

mithatakbulut
Copy link
Contributor

This PR introduces optimistic updates across listings, offers, and collectibles to provide immediate UI feedback and improve overall performance, while also refactoring key components for simpler data handling.

Features

Listings (CreateListingModal):

•Added optimisticListing.tsx for optimistic listing updates.
•	Implemented getOptimisticListingData.ts to generate listing objects based on input/state.
•	Integrated with useTransactionSteps.tsx for apply/rollback behavior.
•	Exported new mutation hooks via hooks/index.ts.

Offers (MakeOfferModal):

•	Added optimisticOffer.tsx for optimistic offer updates.
•	Implemented getOptimisticOfferData.ts to generate offer objects.
•	Integrated with useTransactionSteps.tsx for apply/rollback behavior.
•	Removed manual query invalidation by leveraging optimistic updates.

Collectibles (React Query):

•	Introduced optimisticUpdates.ts with update/rollback functions.
•	Added updateListCollectiblesWithOffer and updateListCollectiblesWithListing.
•	Implemented utility functions to invalidate related queries for consistency.
•	Exported utilities from utils/index.ts.

Refactors

•	Footer & MarketCard:
•	Removed useLowestListing hook from Footer for simpler data flow.
•	Passed lowestListing as a prop from MarketCard.
•	Improved loading state handling in Footer for better clarity and performance.

…g handling

- Removed the useLowestListing hook from the Footer component, simplifying the data fetching logic.
- Added lowestListing prop to the Footer component to allow for direct data passing.
- Updated MarketCard component to retrieve lowestListing from collectible data and pass it to the Footer component.
- Improved loading state logic in the Footer component for better performance and clarity.
- Introduced a new file `optimisticUpdates.ts` containing functions to optimistically update the list of collectibles in the cache when offers or listings are created.
- Implemented `updateListCollectiblesWithOffer` and `updateListCollectiblesWithListing` functions to handle optimistic updates and rollback functionality.
- Added utility functions to invalidate related offer and listing queries to ensure data consistency.
- Exported the new functions from the `index.ts` utility file for accessibility throughout the SDK.
- Introduced `optimisticOffer.tsx` to manage optimistic updates for offers, allowing for immediate UI feedback while ensuring data consistency.
- Implemented `getOptimisticOfferData` in `getOptimisticOfferData.ts` to generate optimistic offer objects based on user input and current state.
- Updated `useTransactionSteps.tsx` to integrate optimistic updates, applying them after a successful transaction and rolling back if the transaction fails.
- Removed the need for manual query invalidation by leveraging optimistic updates for a more efficient data handling approach.
- Introduced `optimisticListing.tsx` to handle optimistic updates for listings, allowing for immediate UI feedback while ensuring data consistency.
- Added `getOptimisticListingData.ts` to generate optimistic listing objects based on user input and current state.
- Updated `useTransactionSteps.tsx` to integrate optimistic updates, applying them after a successful transaction and rolling back if the transaction fails.
- Modified `index.ts` in the hooks directory to export the new mutation hooks for better accessibility throughout the SDK.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant