Prevent crashes when task types, users and related records are missing - #2163
Merged
Conversation
Lets source use ES2021 syntax such as the logical assignment operators. Parse-only: browser support is unchanged, still governed by browserslist and the Vite es2020 target.
Compact NDJSON with-tasks rows rebuild assignees positionally; a field layout without it left task.assignees undefined and crashed unguarded reads (TaskInfo isAssigned). Default it to [] at decode, and harden the two isAssigned reads.
user is null during logout teardown; optional-chain the user id read in isAssigned and the comment ownership checks.
taskTypeMap.get returns undefined for a stale task_type_id; return early instead of reading for_entity on it.
…atuses and task types
Optional-chaining for_entity only moved the crash: pluralizeEntityType falls back to '' and vue-router rejects an empty required :type param, so the link threw during resolution instead of rendering. The segment is never read back, so getTaskRouteEntity falls back to the task's own entity type.
USER_LOGOUT sets state.user to null while the page is still mounted, so the comment ownership checks and isAssigned threw during teardown. TaskInfo was already fixed; this brings its sibling page to parity.
resolveAuthor returns undefined when the person is not in personMap, which is why the template already reads comment.person?.id. The export row builder still dereferenced the author and the status.
taskTypeList mapped validation columns through taskTypeMap without filtering, so a hole crashed the four remaining query builders, addTaskTypeFilter and the active watcher. Filtering at the source also keeps the assetsready clause the user configured instead of silently dropping it.
The three reset lists pushed raw map lookups into arrays handed to sortByName, which dereferences name and threw, next to the episode options this PR already guarded.
The task type sort still dereferenced a missing task type, and the guarded status reads rendered a sizeless-but-coloured segment titled "undefined". Filtering both lists removes the crash and the placeholder segment.
Both computed lists mapped ids through taskTypeMap and dereferenced the result, so they threw before the guards added elsewhere in those files could run.
The column prop already defaults to null and the ten list call sites pass a raw taskTypeMap lookup, but cellStyle dereferenced its colour. Guarding here covers every list instead of each header separately.
Keying on the task type made the key nullish for an unresolved column. The two sibling stats lists already key on columnId.
Defaulting the person fields to undefined leaked a budget.positions.undefined key into the exported CSV and turned the monthly salary into NaN through the daily salary multiplication.
A task type present but without for_entity fell through the earlier guard and still produced an empty :type, and reaching the episode branch by fallback with no entity_id left episode_id empty instead. Both now keep a resolvable route.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
assignees, leavingtask.assigneesundefined and crashing TaskInfo.isAssigneddereferenced a null user during logout/login teardown, and the Task page kept doing the same in its comment ownership checks.for_entityfed an empty required:typeparam to vue-router, so task links, validation tags and comment preview links still threw at resolution.undefinedposition key in the exported budget CSV and aNaNmonthly salary in the budget totals.Solution
assigneesto an empty array in the compact task decoder.isAssignedand the comment ownership checks against a null user on both the task sidebar and the task page.filter(Boolean), also fixing a pre-existing assignee sort that compared a name to a person object.sortByPersonNamehelper shared by the shot, asset, edit, episode and sequence stores, and cover it with a unit test.:typesegment always resolves, covered by unit tests ongetTaskPath.