equinor / equinor/fusion-framework

context: replace index-based skipFirst check in ContextProvider.connectParentContext with a clearer mechanism

Open Beginner friendly
#5,121 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
10
Forks
10
Avg merge
19h 40m
Merged PRs (30d)
150

Description

In `ContextProvider.connectParentContext`, the `skipFirst` handling is marked as hacky:

```ts
filter((next, index) => {
// skip first item if opt.skipFirst is true
// TODO: this is a bit hacky, should be handled in a better way
if (opt?.skipFirst && index <= 1) {
console.debug('ContextProvider::connectParentContext', 'skipping first item', next);
return false;
}
...
}),
```

Using an `index <= 1` check on the piped observable to detect "first emitted value" is fragile. Consider a more explicit mechanism (e.g. `skip(1)` combined with a conditional pipe, or a dedicated "seen first value" flag) instead of relying on the index comparison.

_Originally flagged as a `// TODO` comment while resolving fusion-lint warnings on `fix/sematic-lint`._

Contributor guide

Open the contributing guide

Research direction

Start by locating ContextProvider.connectParentContext and read the surrounding observable pipeline, especially the filter that checks opt?.skipFirst and index. Compare an explicit first-emission mechanism such as conditional skip(1) or a seen-value flag, then verify that skipFirst still skips only the first emitted item and that the fusion-lint concern is addressed.

Written by the indexing model from the issue text.

Assessment

Tech stack
react, typescript
Domain
frontend
Issue type
Refactor
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.