forked from OpenNeo/impress
Skip loading alt styles on item preview page
Ah yeah, if you're not on the wardrobe page (so we don't need the Alt Styles UI), and the outfit's `altStyleId` is null (as is the case for the item preview page), then there's no need to load the alt styles for that species. So before this change, going to `/items/123` would include an XHR request to `/species/<id>/alt-styles.json`, which would not be used for anything. After this change, that request is no longer sent. Hooray!
This commit is contained in:
parent
7af1a97161
commit
56d550e86c
1 changed files with 4 additions and 1 deletions
|
@ -12,7 +12,10 @@ export function useAltStylesForSpecies(speciesId, options = {}) {
|
|||
// NOTE: This is actually just a wrapper for `useAltStylesForSpecies`, to share
|
||||
// the same cache key!
|
||||
export function useAltStyle(id, speciesId, options = {}) {
|
||||
const query = useAltStylesForSpecies(speciesId, options);
|
||||
const query = useAltStylesForSpecies(speciesId, {
|
||||
...options,
|
||||
enabled: (options.enabled ?? true) && id != null,
|
||||
});
|
||||
|
||||
return {
|
||||
...query,
|
||||
|
|
Loading…
Reference in a new issue