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

Select2 won't load on Turbolinks navigation #1476

Open
MrSerth opened this issue Jun 21, 2024 · 0 comments
Open

Select2 won't load on Turbolinks navigation #1476

MrSerth opened this issue Jun 21, 2024 · 0 comments
Labels

Comments

@MrSerth
Copy link
Member

MrSerth commented Jun 21, 2024

When localizing CodeHarbor in #1143, we also modified how select2 is loaded (90cf84d). As an unfortunate side effect, however, we are not correctly initializing select2 labels during visits fully handled by Turbolinks.

When navigating a page, Turbolinks aims to reduce page loading times by simply exchanging the document's body. This mostly works fine and indeed is faster than re-parsing all library code on a subsequent page visit. One downside, however, is that the events are not fired as usual. That's happening in this case: Only on a regular, full browser visit, the event select2:locales:loaded is fired. On Turbolinks visits, it is not (since the JavaScript state is also not reinitialized).

Consequentially, the filters shown on the task index page are not necessarily loaded correctly. For example, when switching between Collections and Tasks, the filters are not shown correctly. Only reloading the page without a cache is initializing the filters for me:

Turbolinks.Select2.mov
@MrSerth MrSerth added the bug label Jun 21, 2024
MrSerth added a commit that referenced this issue Aug 15, 2024
Previously, select2 was only loaded successfully, if first the page was loaded (turbolinks:load) and then all select2 locales (select2:locales:loaded). However, if the order was different, select2 wouldn't be initialized.

Fixes #1476
MrSerth added a commit that referenced this issue Aug 15, 2024
Previously, select2 was only loaded successfully, if first the page was loaded (turbolinks:load) and then all select2 locales (select2:locales:loaded). However, if the order was different, select2 wouldn't be initialized.

Fixes #1476
MrSerth added a commit that referenced this issue Aug 15, 2024
Previously, select2 was only loaded successfully, if first the page was loaded (turbolinks:load) and then all select2 locales (select2:locales:loaded). However, if the order was different, select2 wouldn't be initialized.

Fixes #1476
MrSerth added a commit that referenced this issue Aug 15, 2024
Previously, select2 was only loaded successfully, if first the page was loaded (turbolinks:load) and then all select2 locales (select2:locales:loaded). However, if the order was different, select2 wouldn't be initialized.

Fixes #1476
MrSerth added a commit that referenced this issue Aug 15, 2024
Previously, select2 was only loaded successfully, if first the page was loaded (turbolinks:load) and then all select2 locales (select2:locales:loaded). However, if the order was different, select2 wouldn't be initialized.

Fixes #1476
MrSerth added a commit that referenced this issue Aug 16, 2024
Previously, select2 was only loaded successfully, if first the page was loaded (turbolinks:load) and then all select2 locales (select2:locales:loaded). However, if the order was different, select2 wouldn't be initialized.

Fixes #1476
MrSerth added a commit that referenced this issue Aug 16, 2024
Previously, select2 was only loaded successfully, if first the page was loaded (turbolinks:load) and then all select2 locales (select2:locales:loaded). However, if the order was different, select2 wouldn't be initialized.

Fixes #1476
MrSerth added a commit that referenced this issue Aug 16, 2024
Previously, select2 was only loaded successfully, if first the page was loaded (turbolinks:load) and then all select2 locales (select2:locales:loaded). However, if the order was different, select2 wouldn't be initialized.

Fixes #1476
MrSerth added a commit that referenced this issue Aug 26, 2024
Previously, select2 was only loaded successfully, if first the page was loaded (turbolinks:load) and then all select2 locales (select2:locales:loaded). However, if the order was different, select2 wouldn't be initialized.

Fixes #1476
MrSerth added a commit that referenced this issue Aug 28, 2024
Previously, select2 was only loaded successfully, if first the page was loaded (turbolinks:load) and then all select2 locales (select2:locales:loaded). However, if the order was different, select2 wouldn't be initialized.

Fixes #1476
MrSerth added a commit that referenced this issue Aug 30, 2024
Previously, select2 was only loaded successfully, if first the page was loaded (turbolinks:load) and then all select2 locales (select2:locales:loaded). However, if the order was different, select2 wouldn't be initialized.

Fixes #1476
MrSerth added a commit that referenced this issue Sep 3, 2024
Previously, select2 was only loaded successfully, if first the page was loaded (turbolinks:load) and then all select2 locales (select2:locales:loaded). However, if the order was different, select2 wouldn't be initialized.

Fixes #1476
MrSerth added a commit that referenced this issue Sep 8, 2024
Previously, select2 was only loaded successfully, if first the page was loaded (turbolinks:load) and then all select2 locales (select2:locales:loaded). However, if the order was different, select2 wouldn't be initialized.

Fixes #1476
MrSerth added a commit that referenced this issue Sep 12, 2024
Previously, select2 was only loaded successfully, if first the page was loaded (turbolinks:load) and then all select2 locales (select2:locales:loaded). However, if the order was different, select2 wouldn't be initialized.

Fixes #1476
MrSerth added a commit that referenced this issue Sep 12, 2024
Previously, select2 was only loaded successfully, if first the page was loaded (turbolinks:load) and then all select2 locales (select2:locales:loaded). However, if the order was different, select2 wouldn't be initialized.

Fixes #1476
MrSerth added a commit that referenced this issue Sep 25, 2024
Previously, select2 was only loaded successfully, if first the page was loaded (turbolinks:load) and then all select2 locales (select2:locales:loaded). However, if the order was different, select2 wouldn't be initialized.

Fixes #1476
MrSerth added a commit that referenced this issue Sep 25, 2024
Previously, select2 was only loaded successfully, if first the page was loaded (turbolinks:load) and then all select2 locales (select2:locales:loaded). However, if the order was different, select2 wouldn't be initialized.

Fixes #1476
MrSerth added a commit that referenced this issue Sep 29, 2024
Previously, select2 was only loaded successfully, if first the page was loaded (turbolinks:load) and then all select2 locales (select2:locales:loaded). However, if the order was different, select2 wouldn't be initialized.

Fixes #1476
MrSerth added a commit that referenced this issue Sep 30, 2024
Previously, select2 was only loaded successfully, if first the page was loaded (turbolinks:load) and then all select2 locales (select2:locales:loaded). However, if the order was different, select2 wouldn't be initialized.

Fixes #1476
MrSerth added a commit that referenced this issue Oct 2, 2024
Previously, select2 was only loaded successfully, if first the page was loaded (turbolinks:load) and then all select2 locales (select2:locales:loaded). However, if the order was different, select2 wouldn't be initialized.

Fixes #1476
MrSerth added a commit that referenced this issue Oct 7, 2024
Previously, select2 was only loaded successfully, if first the page was loaded (turbolinks:load) and then all select2 locales (select2:locales:loaded). However, if the order was different, select2 wouldn't be initialized.

Fixes #1476
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant