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

Attempt to mitigate a race condition corrupting the mods.yml file #1424

Merged
merged 1 commit into from
Sep 11, 2024

Conversation

anttimaki
Copy link
Collaborator

@anttimaki anttimaki commented Aug 30, 2024

There exists a race condition between disabling the ordering of the local mod list and user starting to drag an item:

  1. Have a large, slow profile open on local mod list
  2. Have the text filter and ordering dropdowns set to support ordering by dragging
  3. Write something to the text filter and start dragging a mod before the UI updates to disable dragging
  4. Keep the dragging active by keeping the mouse button pressed
  5. Once the text filter is applied to the mod list:
    • If the mod being dragged has been filtered out and is no longer part of the list SortableJS throws unhandled type errors: Cannot read properties of null (reading 'Sortable1724978245665')
    • If the mod being dragged is still visible on the mod list and it's released so its ordinal changes, the currently visible mod list is used to overwrite the contents of the mods.yml file

Other paths to trigger a similar condition are likely to exists.

Fixing the race condition itself seems difficult. This easy fix can at least prevent the worst outcome in some situations.

There exists a race condition between disabling the ordering of the
local mod list and user starting to drag an item:

1. Have a large, slow profile open on local mod list
2. Have the text filter and ordering dropdowns set to support ordering
   by dragging
3. Write something to the text filter and start dragging a mod before
   the UI updates to disable dragging
4. Keep the dragging active by keeping the mouse button pressed
5. Once the text filter is applied to the mod list:
     - If the mod being dragged has been filtered out and is no longer
       part of the list SortableJS throws unhandled type errors:
       Cannot read properties of null (reading 'Sortable1724978245665')
     - If the mod being dragged is still visible on the mod list and
       it's released so its ordinal changes, the currently visible mod
       list is used to overwrite the contents of the mods.yml file

Other paths to trigger a similar condition are likely to exists.

Fixing the race condition itself seems difficult. This easy fix can
at least prevent the worst outcome in some situations.
@anttimaki anttimaki requested a review from ebkr August 30, 2024 11:09
@anttimaki anttimaki merged commit 69cda7c into develop Sep 11, 2024
5 of 7 checks passed
@anttimaki anttimaki deleted the filtering-ordering-race-condition branch September 11, 2024 05:46
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