Skip to content

Conversation

Copy link

Copilot AI commented May 23, 2025

This PR addresses an issue with ID generation logic in the Keyborg library. Currently, IDs are generated using a letter prefix followed by an incrementing number, but this approach can lead to conflicts when multiple versions of the library are loaded in the same context.

Changes

  • Modified the ID generation in KeyborgCore constructor from "c" + ++_lastId to "c-" + ++_lastId
  • Modified the ID generation in Keyborg private constructor from "k" + ++_lastId to "k-" + ++_lastId

Benefits

  • Adds a dash separator between prefix and number, making IDs more distinguishable
  • Reduces potential for ID conflicts when multiple versions of the library are loaded
  • Makes the library more robust in complex application scenarios
  • Maintains backward compatibility with existing functionality
  • Changes are minimal and focused only on ID generation format

Testing

The changes have been verified through:

  • Successful linting checks
  • Successful build
  • Bundle size verification (no significant impact)

This improvement helps avoid issues in applications that might load multiple versions of Keyborg, while keeping the implementation simple and maintaining the existing functionality.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Co-authored-by: mathis-m <11584315+mathis-m@users.noreply.github.com>
Copilot AI changed the title [WIP] Simplify ID generation in Keyborg.ts Update ID generation logic to add dash between prefix and number May 23, 2025
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.

1 participant