mirror of
https://github.com/maziggy/bambuddy.git
synced 2026-09-30 11:12:35 +02:00
Two bugs surfaced by @flom89 in the same thread: (1) The Write-Tag page hardcoded api.getSpools and friends regardless of inventory backend. Users in Spoolman mode saw internal spools they never created and a successful tag write would have bound the NFC tag to the wrong backend (the backend write-tag route is mode-aware; the frontend was driving it with the wrong IDs). Fix follows the InventoryPageRouter pattern: detect spoolmanMode from getSpoolmanSettings, gate the spool fetch on spoolmanModeReady to avoid the initial wrong-backend request, and branch all 6 API call sites (list, autocomplete, untag, K-profile save, single create, bulk create — the bulk variant returns a different envelope shape so the duck-typed check from SpoolFormModal is mirrored). (2) The spool ID was missing from three more SpoolBuddy components beyond the first round of #1439 work — SpoolInfoCard (the dashboard's right-side found-tag panel — the "main screen" view the reporter named), InventorySpoolInfoCard, and SpoolBuddyAmsPage's assigned-spool block. Same #1385 pattern (#<id> in muted small monospace with shrink-0).
React + TypeScript + Vite
This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules.
Currently, two official plugins are available:
- @vitejs/plugin-react uses Babel (or oxc when used in rolldown-vite) for Fast Refresh
- @vitejs/plugin-react-swc uses SWC for Fast Refresh
React Compiler
The React Compiler is not enabled on this template because of its impact on dev & build performances. To add it, see this documentation.
Expanding the ESLint configuration
If you are developing a production application, we recommend updating the configuration to enable type-aware lint rules:
export default defineConfig([
globalIgnores(['dist']),
{
files: ['**/*.{ts,tsx}'],
extends: [
// Other configs...
// Remove tseslint.configs.recommended and replace with this
tseslint.configs.recommendedTypeChecked,
// Alternatively, use this for stricter rules
tseslint.configs.strictTypeChecked,
// Optionally, add this for stylistic rules
tseslint.configs.stylisticTypeChecked,
// Other configs...
],
languageOptions: {
parserOptions: {
project: ['./tsconfig.node.json', './tsconfig.app.json'],
tsconfigRootDir: import.meta.dirname,
},
// other options...
},
},
])
You can also install eslint-plugin-react-x and eslint-plugin-react-dom for React-specific lint rules:
// eslint.config.js
import reactX from 'eslint-plugin-react-x'
import reactDom from 'eslint-plugin-react-dom'
export default defineConfig([
globalIgnores(['dist']),
{
files: ['**/*.{ts,tsx}'],
extends: [
// Other configs...
// Enable lint rules for React
reactX.configs['recommended-typescript'],
// Enable lint rules for React DOM
reactDom.configs.recommended,
],
languageOptions: {
parserOptions: {
project: ['./tsconfig.node.json', './tsconfig.app.json'],
tsconfigRootDir: import.meta.dirname,
},
// other options...
},
},
])