Skip to content

Conversation

@Gaubee
Copy link
Contributor

@Gaubee Gaubee commented Jan 20, 2026

Summary

  • Rewrite swiper-sync-context with ready-based lifecycle management to fix EcosystemTab slider position not being remembered after page refresh
  • Fix key-ui package to export TS source directly like other key-* packages

Problem

The EcosystemTab slider position was always resetting to "discover" on page refresh, even though the value was correctly saved in localStorage. The root cause was the Swiper Controller module triggering slideChange events during initialization, which overwrote the saved activeSubPage value.

Solution

Implemented a new Swiper sync lifecycle:

  1. Ready-based connection: Controller connection only established after both Swipers register
  2. Correct execution order: Mark ready → establish Controller connection → slideTo(initialIndex, 0, false)
  3. Guarded callbacks: onSlideChange only fires after ready state is set, filtering out initialization events
  4. Native API: Removed controller prop from Swiper, use swiper.controller.control directly

Changes

File Change
swiper-sync-context.tsx Complete rewrite with new useSwiperMember(selfId, targetId, options) API
ecosystem-desktop.tsx Use new API, remove controller prop
TabBar.tsx Use new API
swiper-sync-demo.tsx Update demo
stores/ecosystem.ts setAvailableSubPages no longer overrides activeSubPage
key-ui/package.json Export TS source directly

- Change key-utils to export src/*.ts directly (no build needed)
- Fix remote miniapp icon/screenshot URL handling with proper URL check
- Absolute URLs (http/https) are preserved, relative paths use new URL()
…c lifecycle

- Rewrite swiper-sync-context with ready-based lifecycle management
- Controller connection only established after both Swipers are ready
- slideTo with runCallbacks=false to prevent triggering slideChange during init
- onSlideChange callback only fires after ready state is set
- Remove controller prop from Swiper, use native API for connection
- Fix setAvailableSubPages to not override activeSubPage
- Fix key-ui package to export TS source directly like other key-* packages
@Gaubee Gaubee merged commit af3eea7 into main Jan 20, 2026
5 checks passed
@Gaubee Gaubee deleted the opencode/shiny-nebula branch January 20, 2026 18:05
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.

2 participants