Skip to content

Translate view: don't try to log UX action for unauthenticated users - #3946

Merged
flodolo merged 13 commits into
mozilla:mainfrom
flodolo:issue3900
Feb 12, 2026
Merged

flodolo merged 13 commits into
mozilla:mainfrom
flodolo:issue3900

Conversation

@flodolo

@flodolo flodolo commented Feb 5, 2026

Copy link
Copy Markdown
Collaborator

Fixes #3900

Not sure if there's a better way to do it.

@codecov-commenter

codecov-commenter commented Feb 5, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 77.71%. Comparing base (bc0faad) to head (a5c9ccf).

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@flodolo
flodolo requested a review from mathjazz February 5, 2026 17:58
Comment thread translate/public/translate.html Resolved
@flodolo

flodolo commented Feb 7, 2026 •

Copy link
Copy Markdown
Collaborator Author

I tried to use the data already available in the frontend instead of adding info to the Django template.

Just in case, I kept the changes in a separate commit, so it's easy to revert 9f6564b

Worth noting that I'm very much hand waving when writing JavaScript, and even more so when writing tests (asked ChatGPT to write one based on test cases).

P.S. this seems to add an additional call to /user-data, and I couldn't figure out a way to avoid that (e.g. by using getUserData, which got me lost in Redux concepts).

Comment thread translate/src/api/uxaction.ts Resolved
@flodolo

flodolo commented Feb 7, 2026

Copy link
Copy Markdown
Collaborator Author

I think I'm in React/Redux hell. I tried moving the authentication state as a parameter of the existing function, but that required adding it to all props, update calls, tests, etc.

This is how far I manage to go. It works, I'm not sure how correct it is in terms of model (e.g. separation).

@flodolo

flodolo commented Feb 8, 2026

Copy link
Copy Markdown
Collaborator Author

I seem to have introduced a bug for "unread notifications", where this action is sent multiple times.

@eemeli eemeli left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm pretty sure that all but the getEntities/EntitiesList changes can be left out of this PR, as they're in code that's never reached when not authenticated. See my inline comment in translate/src/modules/entities/actions.ts‎ for what I think ought to be done instead.

@flodolo

flodolo commented Feb 12, 2026

Copy link
Copy Markdown
Collaborator Author

Sorry for the churn with this. While trying to update the tests, I realized that we log on getEntities(), which means we log not only when the user searches, but also on scrolling.

I believe that behavior is incorrect: we want to measure the options used when searching, it's not useful to know if the user scrolls through the same results.

I moved the log to the loading of the component, and updated tests (hopefully correctly this time 🤦🏼).

@flodolo

flodolo commented Feb 12, 2026

Copy link
Copy Markdown
Collaborator Author

Side note: while the tests were bad, I've been testing the code authenticated and not authenticated in my local docker installation.

@flodolo
flodolo requested a review from eemeli February 12, 2026 12:26

@eemeli eemeli left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks pretty good, and likely fixes the scrolling issue as well.

@flodolo
flodolo merged commit 06517d3 into mozilla:main Feb 12, 2026
6 checks passed
@flodolo
flodolo deleted the issue3900 branch February 12, 2026 13:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Forbidden: /log-ux-action/ errors in logs

4 participants