Jql editor autocomplete rest
Autocomplete REST API integration for the JQL Editor.
yarn add @atlaskit/jql-editor-autocomplete-rest
3.0.0
Major Changes
-
#117363
10a0f7f6c2027
- This package'speerDependencies
have been adjusted forreact
and/orreact-dom
to reflect the status of only supporting React 18 going forward. No explicit breaking change to React support has been made in this release, but this is to signify going forward, breaking changes for React 16 or React 17 may come via non-major semver releases.Please refer this community post for more details: https://community.developer.atlassian.com/t/rfc-78-dropping-support-for-react-16-and-rendering-in-a-react-18-concurrent-root-in-jira-and-confluence/87026
Patch Changes
- Updated dependencies
Note: This component is designed for internal Atlassian development.
External contributors will be able to use this component but will not be able to submit issues.
This package wraps the callbacks needed to fetch autocomplete data for the JQL editor, and provides simple hooks to delegate to Jira Cloud REST API's.
We require these configurable hooks to allow consumers to define their own fetch library given their app environment, e.g. Jira, Connect, Forge etc.
Usage
A minimal configuration of the autocomplete provider is as follows:
import { useAutocompleteProvider } from '@atlaskit/jql-editor-autocomplete-rest';
const getInitialData = async (url: string) => {
const response = await fetch(url, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ includeCollapsedFields: true })
});
const data = response.json();
return {
jqlFields: data.visibleFieldNames,
jqlFunctions: data.visibleFunctionNames,
};
};
const getSuggestions = async (url: string) => {
const response = await fetch(url);
return response.json();
};
const useMyAutocompleteProvider = () => {
return useAutocompleteProvider('my-app', getInitialData, getSuggestions);
};
Support
For developers outside of Atlassian looking for help, or to report issues, please make a post on the community forum. We will monitor the forums and redirect topics to the appropriate maintainers.