CentreForDigitalHumanities / CentreForDigitalHumanities/parseport
Outfactor shared logic in input components
- Dominant language
- JavaScript
- Stars
- 2
- Forks
- 1
- PR merge metrics
- No merged PRs in 30d
Description
Okay, considering the `exportResult` function from `spindle.component.ts`:
```typescript
public parse(): void {
this.form.controls.mpInput.markAsTouched();
this.form.controls.mpInput.updateValueAndValidity();
const input = this.form.controls.mpInput.value;
if (this.form.invalid || !input) {
return;
}
this.apiService.input$.next(input);
}
```
These functions are very similar: could we think of a good way to make them generalizable / put them in a service? Is that even worthwhile, do you think? I'm happy to let this rest since it's not really priority but I was wondering all the same.
_Originally posted by @Meesch in https://github.com/CentreForDigitalHumanities/parseport/pull/84#discussion_r1907241970_
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by reading the exportResult function in spindle.component.ts alongside the parse function shown in the issue, then locate the other similar input-component functions. Determine whether their shared logic can be generalized without obscuring component-specific behavior; done means an agreed reusable design and corresponding refactor, with tests updated if existing coverage applies.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- frontend
- Issue type
- Refactor
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100