LabKey / labkey-ui-components

This repository defines all of the npm packages available in the @labkey scope.
Other
2 stars 2 forks source link

QuerySelect: functional refactor, introduce autoInit prop #1460

Closed labkey-nicka closed 5 months ago

labkey-nicka commented 5 months ago

Rationale

This converts the implementation of QuerySelect to a React functional component which makes it usable with hooks. Additionally, this introduces a new autoInit prop that allows for users to skip initialization. This is most useful in test environments where, in general, we don't want this component to be initializing and making requests. I explored an alternative solution where this utilizes the query APIWrapper, however, as expected this still requires significant mocking/fixturing to get working in all cases which isn't worth the investment as this time.

The autoInit property defaults to false in test environments and I'm seeing ~25% reduction in total test time in CI for this package.

Related Pull Requests

Changes