Skip to content

Implement lazy loading for combobox technology icons using IntersectionObserver#1264

Open
max-ostapenko wants to merge 1 commit into
mainfrom
teenage-shrimp
Open

Implement lazy loading for combobox technology icons using IntersectionObserver#1264
max-ostapenko wants to merge 1 commit into
mainfrom
teenage-shrimp

Conversation

@max-ostapenko
Copy link
Copy Markdown
Contributor

@max-ostapenko max-ostapenko commented Jun 5, 2026

The log entries indicated that an incoming request to the report-api backend service was denied with a 403 Forbidden status code by a Google Cloud Armor security policy. Specifically, the request from particular IPs exceeded the rate limit threshold defined in the policy named report-api-backend-security-policy.

This means:

  • The individual client IPs make an abnormally high volume of requests.
  • The default rate limit threshold configured in the Cloud Armor policy is too restrictive for our users.

The solution:
Optimized the technology dropdown list to prevent fetching 2,000+ technology icons simultaneously on load or filter, avoiding overwhelming both the client browser's connection limit and the CDN.

…rsectionObserver

Signed-off-by: Max Ostapenko <1611259+max-ostapenko@users.noreply.github.com>
@max-ostapenko max-ostapenko requested a review from tunetheweb June 5, 2026 20:21
// Add options in the dropdown list
const listbox = this.element.querySelector('[role="listbox"]');

const hasObserver = typeof IntersectionObserver !== 'undefined';
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 loading=lazy attribute means all this code shouldn't be needed.

However, it seems to me Safari is not honouring this and loads everything 😔 It seems to work fine in Chrome and Firefox. But then we see the error in Lighthouse too, which uses Chrome 🤔

But this does seem to fix it for Safari. Is that why you're adding this? Or are there other reasons? I think we should add a comment here.

Suggested change
const hasObserver = typeof IntersectionObserver !== 'undefined';
// Safari doesn't seem to honour `loading=lazy and loads all icons
// so use a manual IntersectionObserver for now.
const hasObserver = typeof IntersectionObserver !== 'undefined';

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.

2 participants