Closed andressommerhoff closed 5 months ago
Hi @emilhe! I noticed that the unit tests failed due to a timeout. Do you know why? It's possible that a test server was down and could not be reached. I would like to retry the test, but I don't see the option. Perhaps I don't have the necessary permissions?
This seems like a reasoanble extension. I agree that the test failure doesn't seem to be related to the code changes.
Context: Before this commit, the
prefix
parameter ofDashBlueprint.register()
could only accept a string, which would then be used to create and register a defaultPrefixIdTransform
instance in thetransforms
list of the blueprint. This behavior restricted the flexibility as it only utilized the standardPrefixIdTransform
with no possibility to specify a custom escape function.Problem: While
PrefixIdTransform
itself does offer the option to specify a custom escape function, this option is lost when using theprefix
parameter ofDashBlueprint.register()
, as it defaults to using the standardPrefixIdTransform
. In many use cases, such as mine, there is a need to skip the prefix modification for specific elements, which was not feasible without implementing a cumbersome workaround. This limitation was due to the inability to use a custom escape function within thePrefixIdTransform
created byregister()
.Solution: This commit enhances the functionality of
DashBlueprint.register()
by allowing theprefix
parameter to accept either a string or a customPrefixIdTransform
instance. This change introduces the following improvements:Customizability: Developers can now pass a custom
PrefixIdTransform
instance with their own logic for the escape function, allowing for greater control over which components are affected by the prefixing.Flexibility: By enabling the direct use of a customized
PrefixIdTransform
, developers retain the option to specify how and when to apply the escape logic.Reduced Complexity: It eliminates the need for complex workarounds previously required to handle special cases where prefixing should be selectively applied.
Clarity and Maintainability: The prefix machinery more maintainable by directly supporting different configurations of
PrefixIdTransform
.Impact: This change will significantly enhance the flexibility and usability of
DashBlueprint.register()
for developers needing more control over component ID transformations. It aligns with the principles of extensibility and customization. Additionally, it ensures that the powerful features ofPrefixIdTransform
, such as custom escape functions, are fully usable in all scenarios, supporting complex application architectures more effectively.