-
Notifications
You must be signed in to change notification settings - Fork 323
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Batch asset invalidations #11937
base: develop
Are you sure you want to change the base?
Batch asset invalidations #11937
Conversation
…tion to the backend is in flight
weird, we should already be doing this, right? |
would you happen to know how we managed to avoid that previously? |
anyway @MrFlashAccount ready for re-review i guess. lmk if there are specific things i should split out |
app/gui/src/dashboard/components/dashboard/column/LabelsColumn.tsx
Outdated
Show resolved
Hide resolved
return result | ||
} | ||
}, [listUserGroupsQuery.data, listUsersQuery.data]) | ||
const listUserGroupsQuery = useBackendQuery(backend, 'listUserGroups', EMPTY_ARRAY) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FWIW, using queries like this should be discouraged as it throws away the state of the query - loading, fetching, error, etc. instead, we should fetch on components level and if we want to hide some logic behind an abstraction - introduce a hook/function that accepts data as parameters
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Still not final yet, tired of reading changes like []
-> EMPTY_ARRAY
type RestoreAssetsMutation = Mutation<null, Error, readonly AssetId[]> | ||
|
||
/** Return matching in-flight "restore assets" mutations. */ | ||
export function useRestoreAssetsMutationState<Result>( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe it's better to call it useIsRestoring...
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it returns the mutation object, not a boolean, so i'm not sure whether that name makes sense
} | ||
|
||
/** Clear the trash folder. */ | ||
export function useClearTrashMutation(backend: Backend) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we can unify this hook with removing a group of items, a single item, by passing the ids into mutation params?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
how's that different to the current code?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i think this has the same "wrap mutation into a mutation" issue btw - but i'm not sure how to fix it because we potentially need to do a fetch for this one
} | ||
|
||
/** Duplicate a specific version of a project. */ | ||
export function useDuplicateProjectMutation(backend: Backend) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please ask Pawel if we need to specify a name for duplicating assest (now we don't need to pass a name when we create them), but this makes sense for the LocalBackend.
} | ||
|
||
/** Call "add label" mutations for a list of assets. */ | ||
export function addAssetsLabelsMutationOptions(backend: Backend) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This makes me wondering, why somewhere we use useMutation
, in other places we use mutationOptions
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ideally everything should be mutationOptions
imo, but some of them need to use hooks so that is not possible as is
app/gui/src/dashboard/layouts/Settings/ActivityLogSettingsSection.tsx
Outdated
Show resolved
Hide resolved
app/gui/src/dashboard/components/dashboard/column/LabelsColumn.tsx
Outdated
Show resolved
Hide resolved
b0a3b11
to
a1d8517
Compare
Pull Request Description
Codebase changes:
AssetEvent
s andAssetListEvent
s. Remaining events have been moved to TanStack Query mutations in this PR, as it is neccessary for batch invalidation functionality.key
anddirectoryKey
fromAssetTreeNode
, andkey
s in general in favor ofid
s. Not strictly necessary, but it was causing logic issues and is (IMO) a nice simplification to be able to do.Important Notes
None
Testing instructions
Checklist
Please ensure that the following checklist has been satisfied before submitting the PR:
The documentation has been updated, if necessary.Scala,
Java,
TypeScript,
and
Rust
style guides. In case you are using a language not listed above, follow the Rust style guide.
Unit tests have been written where possible.If meaningful changes were made to logic or tests affecting Enso Cloud integration in the libraries,or the Snowflake database integration, a run of the Extra Tests has been scheduled.
If applicable, it is suggested to paste a link to a successful run of the Extra Tests.