feat: update components and hooks to use get_untracked for improved performance

This commit is contained in:
asepharyana
2026-07-04 03:03:36 +07:00
parent 8166023f91
commit 27e929580e
85 changed files with 1703 additions and 1843 deletions
-48
View File
@@ -1,48 +0,0 @@
# ---- Builder Stage ----
FROM node:22-alpine AS builder
ARG VITE_BE_API_URL
ARG VITE_BE_WS_URL
WORKDIR /app
# Install pnpm
RUN npm install -g pnpm
# Copy dependency definition files first for caching
COPY pnpm-workspace.yaml .
COPY pnpm-lock.yaml .
COPY package.json .
# Copy patches (pnpm patchedDependencies)
COPY patches ./patches
# Copy workspace dependency
COPY packages/shared ./packages/shared
# Copy service
COPY services/frontend ./services/frontend
# Install dependencies
RUN --mount=type=cache,id=pnpm-store,target=/root/.local/share/pnpm/store \
pnpm install --frozen-lockfile
# Build shared workspace dependency first (required for TypeScript declarations)
RUN --mount=type=cache,id=pnpm-store,target=/root/.local/share/pnpm/store \
pnpm --filter './packages/shared' run build
# Build frontend (env vars injected at build time)
RUN VITE_BE_API_URL=${VITE_BE_API_URL} VITE_BE_WS_URL=${VITE_BE_WS_URL} pnpm --filter './services/frontend' run build
# ---- Runner Stage ----
FROM nginx:alpine
# Copy Nginx config
COPY infra/docker/nginx/nginx-frontend.conf /etc/nginx/conf.d/default.conf
# Copy built static files from builder stage
COPY --from=builder /app/services/frontend/dist /usr/share/nginx/html
EXPOSE 3000
CMD ["nginx", "-g", "daemon off;"]
+25
View File
@@ -1,7 +1,32 @@
# ---- Builder Stage (Frontend WASM) ----
FROM rust:alpine AS frontend-builder
RUN apk add --no-cache musl-dev
RUN rustup target add wasm32-unknown-unknown
RUN cargo install trunk --locked
WORKDIR /app
# Copy workspace definition and lock file for dependency caching
COPY services/frontend/Cargo.toml services/frontend/Cargo.lock ./
# Copy shared-types library
COPY services/frontend/shared-types ./shared-types/
# Copy frontend source
COPY services/frontend/frontend ./frontend/
# Build WASM bundle via trunk
RUN cd frontend && trunk build --release
# ---- Runner Stage ----
FROM nginx:alpine
COPY infra/docker/nginx/nginx.conf /etc/nginx/conf.d/default.conf
# Copy frontend static files from builder stage
COPY --from=frontend-builder /app/frontend/dist /usr/share/nginx/html
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]
+3 -24
View File
@@ -1,7 +1,8 @@
version: '3.8'
services:
# Nginx Reverse Proxy — handles /api and /ws routing behind Traefik
# Nginx Reverse Proxy + Frontend Static Files
# Routes /api and /ws to backend, serves frontend WASM directly
proxy:
image: registry.gitlab.com/mytheclipse-group/gmw/bete-proxy:latest
container_name: imphenbot-proxy
@@ -15,7 +16,7 @@ services:
depends_on:
- backend
healthcheck:
test: ["CMD", "nginx", "-t"]
test: ["CMD", "wget", "-qO-", "http://127.0.0.1/"]
interval: 30s
timeout: 5s
retries: 3
@@ -36,7 +37,6 @@ services:
environment:
NODE_ENV: production
WEBSERVER_PORT: 3000
# Backend talks to gateway via Redis+Postgres, not directly — no depends_on needed
healthcheck:
test: ["CMD", "wget", "-qO-", "http://localhost:3000/api/health"]
interval: 30s
@@ -61,7 +61,6 @@ services:
NODE_ENV: production
volumes:
- ./recordings:/app/recordings
# Gateway has no HTTP server — check if PID 1 (node) is alive
healthcheck:
test: ["CMD-SHELL", "kill -0 1 || exit 1"]
interval: 30s
@@ -75,26 +74,6 @@ services:
networks:
- app-shared-net
# Frontend Service (React Dashboard) — Nginx serving static files
frontend:
image: registry.gitlab.com/mytheclipse-group/gmw/bete-frontend:latest
container_name: imphenbot-frontend
restart: unless-stopped
# Use 127.0.0.1 instead of localhost — Alpine's BusyBox wget tries IPv6 first
# for 'localhost' which fails since nginx only listens on IPv4
healthcheck:
test: ["CMD", "wget", "-qO-", "http://127.0.0.1:3000/"]
interval: 30s
timeout: 5s
start_period: 5s
retries: 3
deploy:
resources:
limits:
memory: 32M
networks:
- app-shared-net
networks:
app-shared-net:
name: app-shared-net
-24
View File
@@ -1,24 +0,0 @@
# Nginx config for serving Vite-built static frontend files
server {
listen 3000;
server_name _;
root /usr/share/nginx/html;
index index.html;
# Gzip compression for faster load times
gzip on;
gzip_types text/plain text/css application/json application/javascript image/svg+xml;
gzip_min_length 256;
# Cache static assets (JS/CSS hashed filenames)
location /assets/ {
expires 1y;
add_header Cache-Control "public, immutable";
}
# SPA fallback — all non-file routes serve index.html
location / {
try_files $uri $uri/ /index.html;
}
}
+22 -8
View File
@@ -1,7 +1,7 @@
# Docker DNS resolver (127.0.0.11 = Docker's embedded DNS).
# Required for variable-based proxy_pass below to resolve upstream
# hostnames on each request instead of caching them at startup.
# Without this, when backend/frontend containers are recreated (new IP),
# Without this, when backend containers are recreated (new IP),
# nginx keeps pointing to stale IPs → 502 Bad Gateway.
# Valid=10s re-resolves at most every 10 seconds to avoid excessive DNS queries.
resolver 127.0.0.11 ipv6=off valid=10s;
@@ -43,13 +43,27 @@ server {
proxy_send_timeout 86400s;
}
# Frontend SPA fallback
# WASM MIME type
types {
application/wasm wasm;
}
# Gzip for static assets
gzip on;
gzip_types text/plain text/css application/json application/javascript application/wasm image/svg+xml;
gzip_min_length 256;
# Cache static assets (JS/WASM hashed filenames)
location /assets/ {
root /usr/share/nginx/html;
expires 1y;
add_header Cache-Control "public, immutable";
}
# Frontend SPA fallback — serve static files directly
location / {
set $frontend_url "http://frontend:3000";
proxy_pass $frontend_url$uri$is_args$args;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
root /usr/share/nginx/html;
index index.html;
try_files $uri $uri/ /index.html;
}
}