mirror of
https://github.com/invoke-ai/InvokeAI.git
synced 2026-04-23 03:00:31 -04:00
implmenet custom sort to replace images adapter logic
This commit is contained in:
committed by
psychedelicious
parent
719c066ac4
commit
7bbe236107
@@ -75,6 +75,19 @@ export const imagesAdapter = createEntityAdapter<ImageDTO, string>({
|
||||
},
|
||||
});
|
||||
|
||||
export const imageListDefaultSort = () => {
|
||||
return (a: ImageDTO, b: ImageDTO) => {
|
||||
if (a.starred && !b.starred) {
|
||||
return -1;
|
||||
}
|
||||
if (!a.starred && b.starred) {
|
||||
return 1;
|
||||
}
|
||||
return dateComparator(b.created_at, a.created_at);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Create selectors for the adapter.
|
||||
export const imagesSelectors = imagesAdapter.getSelectors(undefined, getSelectorsOptions);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user