Hey Hive Fam!
Welcome back, coding ninjas & blockchain bees! ๐๐จโ๐ป๐ฉโ๐ป
It's time for another Hive Dev Logโwith plenty of nerdy upgrades and just enough memes to keep you giggling. Strap in!
๐ Whatโs New in Distriator Frontend?
In my previous update, we turbocharged backend data sync.
Today, it's the frontend's turn!
No more loading every business every time โ just the fresh stuff, delivered FAST. ๐คฉ
๐๏ธ Business Data Caching System
Whatโs going on?
Say goodbye to slow, heavy API calls! Meet the new caching system for the businesses API.
Think: More speed. Less strain. MongoDB finally gets to chill. ๐งโโ๏ธ
โ๏ธ Changes Made
API Endpoint Shuffle
- Old Endpoint:
/business
โ fetched all businesses, all the time (talk about TMI ๐) - New Hotness:
/business/modified-after
โ fetches only those that actually changed (so smart!)
The old version is still live, but todayโs fun is all about the new, efficient one!
Business Model Patch
We got geeky:
- Added:
createdAt
(when business was born) - Added:
updatedAt
(when business had a makeover) - Purpose: Helps us sync only whatโs new or changed. Like, why call your mom if nothing happened? ๐
๐ง Caching That Works Smarter, Not Harder
- First-Time Use:
- App calls
/business/modified-after
with the OG timestamp (1970-01-01T00:00:00.000Z
) โ back to the dinosaurs! ๐ฆ - Saves encrypted businesses locally.
- Grabs max
updatedAt
timestamp, notes it for next sync.
- Storage Keys:
cached_businesses
: Encrypted business bonanza-
last_modified_timestamp
: ISO8601 timestamp -
Next Calls:
- Uses stored timestamp, fetches whatโs NEW or UPDATED only
- Merges with cache, filters
isDeleted: true
- Updates timestamp because, well, time only moves forward!
- Result:
Faster loads, happier database, and yes โ MongoDB FINALLY takes a coffee break. โ๏ธ
๐ Data Safety Dance
- Everything's locked up tight: Encrypted localStorage for businesses
- Only timestamps sit in plain textโnobody hacks what they canโt read! ๐
- Raw API payload is never decrypted locally.
- Reminder: Thereโs no hack-proof, but we make it tough for ordinary mortals.
๐ค New & Improved Functions
fetchBusinessesModifiedAfter()
- Fetches only what's needed, using ISO8601 date
- Talks to server, grabs just fresh or updated business data
fetchBusinessesApi()
- Main caching logic!
- Gives you cached data if nothing changed (like a chill librarian ๐)
- Used to fetch everything, now fetches intelligently
clearBusinessesCache()
- Nukes all cached dataโuseful for tests or hitting big red reset
- Resets timestamps to prehistory
- Keeps devs a little saner
๐จ UI Flare
Refresh Button
- Starring on BusinessList (desktop + mobile)
- Shows spinny loading (who doesnโt love a good spinner!)
- Disabled during heavy lifting
Context Upgrade
BusinessesContext
gets a new superhero:forceRefreshBusinesses
- Still plays nice with all the old components ๐งฉ
โญ Why This Rocks
- Less API Loading: Only gets what's changed, not the whole kitchen sink!
- Turbo Speed: Returning users zoom through business lists
- Offline Ninja: Works even if server's snoozing
- Self-Healing Data: Handles updates, merges, deletions, all behind the curtain
- Youโre in Control: Smash refresh manually if you canโt wait!
And if thereโs nada โ response in 500ms!
Server down? No prob, cache to the rescue.
Now thatโs a WOW feature.
๐ฅ What's Next?
- Backend: โ๏ธ Already done!
- Frontend: โ๏ธ All juiced up!
- Next up: Claim Cashback API gets some turbo tweaks!
- Two pieces:
- See available cashback
- Claim it post-business review
- Stay tuned โ next dev log will have the spicy details!
๐ The Hive Hype Never Stops ๐
- ๐ Keep shopping & keep claiming with Distriator
- ๐ Big love, Hive family!
- ๐ Hive blockchain = ๐๐ to the moon, Mars & beyond!
๐ฅ Until the next dev log โ Keep building, keep Hiving! ๐๐
๐ Final Note
- I asked perplexity to help optimize this post to make it more readable and viewer-friendly & funny
- Here is the link where you can find both original content & improvements made by AI
- https://www.perplexity.ai/search/5979a866-8e29-4087-b450-606aaf62c3d6
๐ My Contributions to โฆ๏ธ Hive Ecosystem
Contribution | To | Hive | Ecosystem |
---|---|---|---|
Hive Witness Node | Hive API Node | 3Speak Video Encoder Node Operator (highest number of nodes) | 3Speak Mobile App Developer |
3Speak Podcast App Developer | 3Speak Shorts App Developer | 3Speak Support & Maintenance Team | Distriator Developer |
CheckinWithXYZ | Hive Inbox | HiFind | Hive Donate App |
Contributed to HiveAuth Mobile App | Ecency โ 3Speak Integration | Ecency โ InLeo Integration | Ecency โ Actifit Integration |
Hive Stats App | Vote for Witness App | HiveFlutterKit | New 3Speak App |
๐ Support Back
โค๏ธ Appreciate my work? Consider supporting @threespeak & @sagarkothari88! โค๏ธ
Vote | For | Witness |
---|---|---|
sagarkothari88 | @sagarkothari88 | |
threespeak | @threespeak |