-
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
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
} | ||
|
||
/** 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
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?
The difference is in queryClient.ensureQueryData
. This hook implicitly get the ids to remove, but I'm proposing an explicit way.
} | ||
|
||
/** 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
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.
Why we can't pass all the needed as args?
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.
fair enough, what about useRemoveSelfPermissionMutation
? which needs to wrap another mutation (both input shape and the list of invalidates)
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.
Let's keep it as is, eventually we'll remove it: https://github.com/enso-org/cloud-v2/issues/1645
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.
there are also the useNew*
which depend on a lot of hooks. i think it's fine for now as well (because they already exist) but should also be discussed in a new issue what we're planning on doing with those
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.