mirror of
https://github.com/maziggy/bambuddy.git
synced 2026-10-01 03:31:25 +02:00
* Fix AMS slot modal not scrolling to preselected filament The scroll useEffect fired before the loading spinner was replaced by the preset list, so the DOM element didn't exist yet. The ref guard was then set, preventing any retry once buttons appeared. - Move isLoading computation before the scroll effect and add it as a dependency so the effect re-runs when loading completes - Gate scroll on !isLoading so it only runs when buttons exist - Only mark scrolledToRef after the element is actually found - Use requestAnimationFrame to scroll after browser layout - Use block:'center' so the selected item is clearly visible Preselect filament for printer-configured AMS slots When an AMS slot was configured directly on the printer (no savedPresetId), the modal didn't preselect the filament even though it was in the list. Add a third fallback that matches trayInfoIdx against the full filteredPresets list (cloud and builtin sources). * Restore scrolledToRef lost during merge The useRef import, scrolledToRef declaration, and its reset were dropped during the 0.2.2b1 merge, causing a ReferenceError in the scroll-to-preselected-filament effect. * Fix preset scroll loop and wire up useEffect scroll logic - Remove inline ref callbacks with scrollIntoView on both preset button lists (fullscreen + standard) to stop the infinite scroll loop on Windows - Add data-preset-id attribute so the existing useEffect/querySelector scroll logic can actually find the elements - Replace filteredPresets dependency with builtinFilaments in the selection useEffect to prevent search keystrokes from overriding manual preset selection * Adjust scroll behavior in ConfigureAmsSlotModal --------- Co-authored-by: MartinNYHC <mz@v8w.de>
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...
},
},
])