query-key-factory
query-key-factory copied to clipboard
PhpStorm freezes on code completion when using mergeQueryKeys()
There are quite a few problems you can see in the attached video using version 1.3.2
https://github.com/lukemorales/query-key-factory/assets/5176891/f8e863e8-455f-4f82-9718-16dbcd1689fe
- code completion poup needs a few seconds to be shown (I hit CTRL+ Space immediately after typin "<sp")
- applying code completion takes an unusable long time (hit Enter when the poup closes)
- syntax errors (red underlines) need a long time to be shown)
I tried a few things to narrow down the source of the lag:
- completely removing all JS Code within the file => no lag
- using key and function directly => no lag (see image below)
- using export from
createQueryKeys
directly => no lag - using export from
mergeQueryKeys
with only teamQueries => extreme lag - returning just a string or array in query function does not change anything
File: index.ts
import { mergeQueryKeys } from '@lukemorales/query-key-factory';
import { teamQueries } from 'src/queries/queries/teams';
export const queries = mergeQueryKeys(teamQueries)
File teams.ts
import { createQueryKeys } from '@lukemorales/query-key-factory';
import TeamMember from 'src/models/TeamMember';
export const teamQueries = createQueryKeys('teams', {
allStats: () => ({
queryKey: [''],
queryFn: () => {
const query = TeamMember.includes([{members: 'person'}]).all()
return query.then(data => data.data);
}
}),
})
I have also submitted a bug report to Jetbrains for the freezing UI, but it sees that the problem is related to query-key-factory or my setup of using this lib https://youtrack.jetbrains.com/issue/WI-73631/Indexing-on-each-start-of-PhpStorm-and-slow-unusuable-code-completion https://youtrack.jetbrains.com/issue/WEB-62694/Slow-highlighting-when-use-lukemorales-query-key-factory-lib