Skip to content

Shouldn't TransferState.set be called only on server side? #54444

@zip-fa

Description

@zip-fa

Which @angular/* package(s) are the source of the bug?

core

Is this a regression?

No

Description

Hi.

I noticed that this piece of code in packages/common/http/src/transfer_cache.ts gets called on client side:

return next(req).pipe(
    tap((event: HttpEvent<unknown>) => {
      if (event instanceof HttpResponse) {
        transferState.set<TransferHttpResponse>(storeKey, {
          [BODY]: event.body,
          [HEADERS]: getFilteredHeaders(event.headers, headersToInclude),
          [STATUS]: event.status,
          [STATUS_TEXT]: event.statusText,
          [URL]: event.url || '',
          [RESPONSE_TYPE]: req.responseType,
        });
      }
    }),
  );

Shouldn't this only be called only on server side? It wastes some memory on client's device

Metadata

Metadata

Assignees

No one assigned

    Labels

    P4A relatively minor issue that is not relevant to core functionsarea: serverIssues related to server-side renderinggood first issueLabel noting a good first issue to be worked on by a community memberopen for contributionsAn issue that is suitable for a community contributor (based on its complexity/scope).server: http cache

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions