You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The page registers an IntersectionObserver and a global snackbar events.on('transaction', ...) listener but does not appear to unregister/disconnect them on unmount. This can lead to duplicate pagination calls and repeated event handling when navigating away and back to the page.
The tokenId field is modeled as an object (TokenIdType) via TokenIdInput, but the validation schema treats it as a string and also marks it as not required. This mismatch can allow invalid submissions or fail validation unexpectedly, and may send a malformed EncodableTokenIdInput to the API.
const tokenId: Ref<TokenIdType> = ref({ tokenId: '', tokenType: TokenIdSelectType.Integer });
const idempotencyKey = ref('');
const skipValidation = ref(false);
const formRef = ref();
const signingAccount = ref('');
const validation = yup.object({
tokenGroupId: yup.number().typeError('Token Group ID must be a number').required(),
collectionId: collectionIdRequiredSchema,
tokenId: stringNotRequiredSchema,
idempotencyKey: stringNotRequiredSchema,
skipValidation: booleanNotRequiredSchema,
});
Collection/token group IDs are handled as strings while the GraphQL schema expects BigInt. Ensure numeric coercion/normalization for collectionId (and similar IDs) before sending requests, and prefer stable keys (e.g., group id) over array indices in v-for to avoid rendering glitches when lists change.
items can become undefined (no edges) and later pagination code spreads ...tokenGroups.value.items, which will throw at runtime. Default items to an empty array and guard forTokenGroup when GetTokenGroup is null/undefined.
Why: forTokenGroups() can currently return items: undefined when edges is missing, and TokenGroups.vue later does [...tokenGroups.value.items, ...data.items], which would throw. Defaulting items to [] and guarding forTokenGroup() against a null GetTokenGroup prevents a real runtime crash.
Medium
Clean up observers and listeners
The IntersectionObserver and events.on(...) listener are never cleaned up, which can cause memory leaks and duplicate pagination/transaction handlers when navigating away and back. Persist the observer instance and unsubscribe/disconnect in an unmount hook, and guard against observing a null paginatorRef.
Why: The IntersectionObserver and events.on('transaction', ...) registration are created on mount but never cleaned up, which can lead to duplicate handlers and leaks when navigating between routes. Adding onBeforeUnmount() cleanup and guarding paginatorRef is a solid reliability improvement for TokenGroups.vue.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.