Skip to content

Redundant server requests being made when there is no logged in user #948

@trichoplax

Description

@trichoplax

Describe the bug
Mentioned in Discord:

There's also another subtle issue there that for logged-out users, that AJAX call will be made every time the method is called, because there are no preferences to cache. Should probably fix that too - it's causing non-trivial request load.

This is referring to the preferences function in qpixel_api.js.

To Reproduce
Not applicable. Open the network section of a developer window and visit one of the Codidact communities in a fresh browser instance with no logged in user and no localStorage (such as private browsing in Firefox or incognito in Chrome). Filter to show only URLs containing "preferences". There should ideally be no requests but there are often hundreds. Numbers for a couple of communities can be found in a comment below

Expected behavior
Preferences should only be requested from the server when there is a logged in user.

Screenshots
Not applicable.

Desktop (please complete the following information):
Smartphone (please complete the following information):
Not operating system related.

Additional context
I have not double checked that this is creating server load. Just raising this based on the Discord comment so it can be looked into. Now confirmed - see To Reproduce above.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: frontendChanges to front-end codecomplexity: unassessedNeeds further developer investigation before complexity/feasibility can be determined.priority: medium

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions