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

Backend Integration unable to upgrade since v2.4.4 #8266

Closed
7 tasks done
rhodee opened this issue May 22, 2022 · 3 comments
Closed
7 tasks done

Backend Integration unable to upgrade since v2.4.4 #8266

rhodee opened this issue May 22, 2022 · 3 comments

Comments

@rhodee
Copy link

rhodee commented May 22, 2022

Describe the bug

Objects do not have the same structure after v2.4.4. I spent some time reviewing the relevant commit log, and recently tried with the latest version (v2.9.9) and the result is consistent.

Thank you for creating the stackblitz setup - I am able to reproduce the issue here as it appears on my machine.

After reviewing the code to see what it does, please open a browser console and click the link. You will see two different logs, which I believe should be identical. Any guidance for backend integration changes to make would be greatly appreciated.

Thank you all for your work on this delightful project.

Reproduction

https://stackblitz.com/edit/vitejs-vite-gy51da

System Info

System:
    OS: macOS 11.6.5
    CPU: (12) x64 Intel(R) Core(TM) i7-8750H CPU @ 2.20GHz
    Memory: 57.79 MB / 16.00 GB
    Shell: 3.4.1 - /usr/local/bin/fish
  Binaries:
    Node: 14.18.1 - ~/.volta/tools/image/node/14.18.1/bin/node
    npm: 7.24.2 - ~/.volta/tools/image/npm/7.24.2/bin/npm
  Browsers:
    Chrome: 101.0.4951.64
    Firefox: 100.0.2
    Safari: 15.4
  npmPackages:
    vite: 2.4.4 => 2.4.4

Used Package Manager

npm

Logs

No response

Validations

@sapphi-red
Copy link
Member

This change (#4279) is affecting it.
Set useDefineForClassFields in tsconfig.json to false to get the previous behavior.

Or change HelloController to

class HelloController extends Controller {
  static targets = ['header'];

  // headerTarget!: HTMLElement;
  declare headerTarget: HTMLElement;

  handleClick(evt: MouseEvent) {
    evt.preventDefault();
    console.log('clicked', this.headerTarget);
  }
}

@sapphi-red sapphi-red closed this as not planned Won't fix, can't repro, duplicate, stale May 22, 2022
@rhodee
Copy link
Author

rhodee commented May 22, 2022

@sapphi-red thank you for reviewing this. I will update the tsconfig.json. What potential impacts would setting this value to false have as it relates to the usage of Vite for future releases as you understand it today?

@sapphi-red
Copy link
Member

From typescript 4.3.2, the default value of useDefineForClassFields is true and some libraries may expect true.
https://vitejs.dev/guide/features.html#typescript-compiler-options

@github-actions github-actions bot locked and limited conversation to collaborators Jun 6, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants