This guide covers common issues you might encounter when using Finsweet Attributes and how to resolve them.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/finsweet/attributes/llms.txt
Use this file to discover all available pages before exploring further.
Loading Issues
Attribute not initializing
Attribute not initializing
Symptoms: Your Attribute doesn’t seem to be working, even though the script is loaded.Possible causes:
-
Missing Attribute key in script tag
Make sure you’ve added the Attribute key to your script tag:
-
Script tag not set to module type
The script must have
type="module": -
Script loaded before elements exist
Place the script tag before the closing
</body>tag to ensure the DOM is ready. -
Typo in Attribute key
Verify the Attribute key matches exactly. It’s case-sensitive:
window.FinsweetAttributes is undefined
window.FinsweetAttributes is undefined
Symptoms: You’re trying to access the API, but
window.FinsweetAttributes is undefined.Solutions:-
Check script loading order
Make sure the Attributes script loads before your custom scripts:
-
Initialize the array before using push()
If you need to use
push()before the library loads: -
Wait for the library to load
Use the optional chaining operator (
?.) or check if it exists:
Multiple instances loading
Multiple instances loading
Symptoms: Your Attribute is initializing multiple times.Cause: You may have included the Attributes script tag multiple times.Solution: Check your Webflow project settings and custom code for duplicate script tags. The library is designed to handle multiple script tags, but each should define different Attributes:
Development Issues
Local development server not working
Local development server not working
Symptoms: Running
pnpm dev fails or the server doesn’t start.Solutions:-
Ensure pnpm is installed
If not installed, install pnpm.
-
Install dependencies
-
Check Node.js version
Ensure you’re using Node.js v18 or higher:
-
Clear pnpm cache
TypeScript errors in development
TypeScript errors in development
Symptoms: Type errors when building or running type checks.Solutions:
-
Run type checking
-
Ensure types are exported correctly
Import types from
@finsweet/attributes-utils: -
Rebuild the project
Tests failing
Tests failing
Symptoms: Tests fail when running
pnpm test.Solutions:-
Run tests in watch mode
-
Check test file location
Tests should be in
packages/attributes/tests/. - Verify test setup Ensure your test imports the correct modules and mocks Webflow if needed.
Runtime Issues
Attribute not finding elements
Attribute not finding elements
Symptoms: Your Attribute loads but doesn’t detect elements with the correct attributes.Solutions:
-
Check attribute syntax
Ensure attributes follow the correct pattern:
-
Verify element exists when Attribute loads
If elements are added dynamically, you may need to restart the Attribute:
- Check for typos in element names Element names must match exactly what the Attribute expects.
Conflicts with other scripts
Conflicts with other scripts
Symptoms: Attributes work when tested alone but fail when other scripts are present.Solutions:
- Check for JavaScript errors Open browser DevTools (F12) and check the Console for errors.
- Load Attributes before other scripts Place the Attributes script tag higher in your HTML.
-
Use destroy() before reinitializing
If you’re dynamically loading content:
Webflow interactions conflicting
Webflow interactions conflicting
Symptoms: Webflow IX2 interactions don’t work properly with Attributes.Cause: Attributes that manipulate the DOM may interfere with Webflow’s interaction engine.Solution: In your custom Attribute, wait for Webflow to be ready:
Performance Issues
Slow page load with multiple Attributes
Slow page load with multiple Attributes
Symptoms: Page takes a long time to load when using several Attributes.Solutions:
-
Use dynamic loading
Instead of loading all Attributes upfront, load them on-demand:
-
Enable auto-loading only for used Attributes
Instead of
fs-attributes-auto, explicitly list the Attributes you need: - Check for redundant initializations Ensure you’re not reloading Attributes unnecessarily.
Memory leaks
Memory leaks
Symptoms: Browser memory usage keeps increasing.Cause: Event listeners or observers not being cleaned up.Solutions:
-
Always implement destroy()
When creating custom Attributes, return a
destroyfunction: -
Use AbortController for event listeners
-
Disconnect observers
Debugging Tips
Enable Verbose Logging
Add console logs to track Attribute lifecycle:Check Attribute Status
Inspect the current state of Attributes:Verify DOM Attributes
Use browser DevTools to inspect elements:- Right-click element → Inspect
- Check that attributes are spelled correctly
- Verify attribute values match expected format
Test in Isolation
Create a minimal test page with just the Attribute and essential code:Getting Help
If you’re still experiencing issues:GitHub Issues
Report bugs or request features
Finsweet Forum
Ask questions and get community support
API Reference
Review the complete API documentation
Custom Attributes
Learn about creating custom solutions
Common Error Messages
'FinsweetAttributes' is not defined
'FinsweetAttributes' is not defined
The Attributes library hasn’t loaded yet. Use optional chaining:
Module not found
Module not found
The Attribute package may not be published or the key is incorrect. Verify the Attribute key matches an existing package.
Cannot read property 'destroy' of undefined
Cannot read property 'destroy' of undefined
The Attribute module hasn’t been loaded. Check that the Attribute initialized successfully: