Skip to content
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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Avatar] WIP #11882

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/kind-tips-marry.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@shopify/polaris': patch
---

WIP
15 changes: 15 additions & 0 deletions polaris-react/src/components/Avatar/Avatar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,16 @@ export function Avatar({
const i18n = useI18n();
const isAfterInitialMount = useIsAfterInitialMount();

useEffect(() => {
// eslint-disable-next-line no-console
console.log('Avatar mounting');

return () => {
// eslint-disable-next-line no-console
console.log('Avatar unmounting');
};
}, []);

const [status, setStatus] = useState<Status>(Status.Pending);

// If the source changes, set the status back to pending
Expand All @@ -99,6 +109,8 @@ export function Avatar({
}
}, [onError]);
const handleLoad = useCallback(() => {
// eslint-disable-next-line no-console
console.log('image loaded');
setStatus(Status.Loaded);
}, []);

Expand Down Expand Up @@ -138,6 +150,9 @@ export function Avatar({
status !== Status.Loaded && styles.hidden,
);

// eslint-disable-next-line no-console
console.log({source, isAfterInitialMount, status});

const imageMarkUp =
source && isAfterInitialMount && status !== Status.Errored ? (
<Image
Expand Down
Loading