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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: add define global #7984

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

kevin9foong
Copy link
Contributor

@kevin9foong kevin9foong commented Dec 10, 2024

Problem

When downloading responses as csv on local, an error seen global is undefined is shown. This prevents the download as csv functionality from working on local development.

Closes FRM-1917

Solution

This is caused since vite does not add polyfills for nodejs builtins (of which global is a nodejs builtin) and the web workers are accessing global.
Hence, the global is explicitly defined as globalThis to fix this issue (sourced from here) which allows standard access to global across different environments.

The globalThis property provides a standard way of accessing the global this value (and hence the global object itself) across environments. Unlike similar properties such as window and self, it's guaranteed to work in window and non-window contexts. In this way, you can access the global object in a consistent manner without having to know which environment the code is being run in.

Breaking Changes

  • No - this PR is backwards compatible

Tests

TC1: can download responses as CSV on staging and prod

  • Download responses as CSV
  • Ensure it downloads correctly with the correct # of rows
  • Download responses as CSV with attachments
  • Ensure all attachments are downloaded successfully and the csv has the correct # of rows.

Copy link

linear bot commented Dec 10, 2024

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.

1 participant