Creating a first class on a project does not toggle corpora/hasMlClasses
The Classifications section of the details panel stays hidden when an element has no classifications and there are no ML classes on a project. After creating an ML class on the project, the section stays hidden on all elements until refreshing the page.
corpora.hasMlClasses
is an object mapping project IDs to booleans, storing whether or not the project has ML classes. We do not store a full list of classes because there can be thousands, so we just keep this boolean to store the only information we really want to cache; whether or not there are any classes.
The listCorpusMlClasses
and createCorpusMlClasses
actions both call the setHasMlClasses
mutation, however it does not allow overriding any existing value; once hasMlClasses[corpusId]
is set, it cannot be changed anymore. This is to protect from the possibility of deducing that there are no ML classes from an API request that would not return all classes (for example a search query that went wrong), but that is already blocked by some other code in listCorpusMlClasses
.
setHasMlClasses
should allow mutating at any time, to let the creation of a first class make the classification creation available immediately.