feat: Enhance Electric SQL integration and update notification handling

- Added initialization script for Electric SQL user in Docker setup.
- Updated Electric SQL client to support new PGlite architecture and sync functionality.
- Improved notification fetching and syncing logic in useNotifications hook.
- Refactored ElectricProvider to handle initialization state and errors more gracefully.
- Removed deprecated electric.config.ts file and adjusted package dependencies accordingly.
This commit is contained in:
Anish Sarkar 2026-01-12 14:53:18 +05:30
parent 82c6dd0221
commit f441c7b0ce
10 changed files with 376 additions and 1046 deletions

View file

@ -8,6 +8,7 @@ services:
volumes:
- postgres_data:/var/lib/postgresql/data
- ./scripts/docker/postgresql.conf:/etc/postgresql/postgresql.conf:ro
- ./scripts/docker/init-electric-user.sql:/docker-entrypoint-initdb.d/init-electric-user.sql:ro
environment:
- POSTGRES_USER=${POSTGRES_USER:-postgres}
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD:-postgres}
@ -115,17 +116,16 @@ services:
electric:
image: electricsql/electric:latest
ports:
- "${ELECTRIC_PORT:-5133}:5133"
- "${ELECTRIC_PORT:-5133}:3000"
environment:
- DATABASE_URL=postgresql://electric:electric_password@db:5432/${POSTGRES_DB:-surfsense}?sslmode=disable
- AUTH_MODE=insecure
- ELECTRIC_INSECURE=true
- ELECTRIC_WRITE_TO_PG_MODE=direct
- ELECTRIC_READ_FROM_PG_MODE=direct
depends_on:
- db
restart: unless-stopped
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:5133/api/health"]
test: ["CMD", "curl", "-f", "http://localhost:3000/v1/health"]
interval: 10s
timeout: 5s
retries: 5