Skip to content

Conversation

@Union-Crax
Copy link
Contributor

This pull request primarily improves the handling of asynchronous data retrieval, error handling, and object manipulation in various background scripts and UI features. The changes ensure that default values and fallback data are correctly awaited, that category filtering is robust and does not mutate original objects, and that image display logic is more resilient to missing data.

Async Data Handling & Error Management

  • Ensured that getDefaultPlantData() and getFallbackColorData() are properly awaited when used as default/fallback values in both extension/background-scripts/index.js and src/background-scripts/data-background-script.js, preventing potential issues with unresolved promises. [1] [2] [3] [4]
  • Updated error handling in getDelijnColorData() to correctly await the fallback color data function, ensuring that fallback data is returned as expected when an error occurs. [1] [2]

Theme Category Filtering

  • Refactored theme category filtering in both extension/background-scripts/index.js and src/background-scripts/themes.ts to use a deep copy of the categories object, preventing mutation of the original, and improved filtering logic to remove hidden and empty categories reliably. [1] [2]

Background Image Display Robustness

  • Improved the setBackground function in src/main-features/appearance/background-image.ts and related usage in extension/index.js to handle cases where image data may be missing, checking for the existence of the result and using optional chaining to avoid runtime errors. [1] [2] [3]

Type and Import Consistency

  • Changed the import of browser in src/fixes-utils/migration.ts to use the .js extension for consistency and compatibility.
  • Updated the type of the appearance parameter in setBackground to any for flexibility.

These changes collectively improve code reliability, maintainability, and user experience by ensuring correct data flow and error handling throughout the extension.

@NightFlavor
Copy link
Collaborator

I mean, mijn Image type wordt ergens random weggehaalt, das ni zo echt nodig eigenlijk, da maakt mijn leven zelfs moeilijker denk ik....

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