Skip to content

[Frontend] Add a note about stimulusFetch & TypeScript config #16815

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

Merged
merged 1 commit into from
May 20, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions frontend/encore/simple-example.rst
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,11 @@ split to *separate* files by Encore. Then, those files won't be downloaded until
the moment a matching element (e.g. ``<div data-controller="lazy-example">``)
appears on the page!

.. note::

If you write your controllers using TypeScript, make sure
``removeComments`` is not set to ``true`` in your TypeScript config.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe extend the sentence to explain the "why"?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if this is necessary? I mean, the config is a comment, so it makes sense without explaining it? Or do you mean to explain that TypeScript is compiled before stimulusFetch config is handled by Simulus bridge?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like the note as is :)


.. _multiple-javascript-entries:

Multiple Entries
Expand Down
5 changes: 5 additions & 0 deletions frontend/ux.rst
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,11 @@ To make one of your custom controllers lazy, add a special comment on top:
To make a third-party controller lazy, in ``assets/controllers.json``, set
``fetch`` to ``lazy``.

.. note::

If you write your controllers using TypeScript, make sure
``removeComments`` is not set to ``true`` in your TypeScript config.

More Advanced Setup
-------------------

Expand Down