Skip to content

feat(transfer): add requested improvements#220

Merged
Mohammer5 merged 10 commits intomasterfrom
Transfer_improvements
Aug 14, 2020
Merged

feat(transfer): add requested improvements#220
Mohammer5 merged 10 commits intomasterfrom
Transfer_improvements

Conversation

@Mohammer5
Copy link
Copy Markdown
Contributor

@Mohammer5 Mohammer5 commented Jul 28, 2020

  • TECH-378: Add onSourceEndReached & onPickedEndReached` callbacks
  • TECH-379: Add loadingSource & loadingPicked flags
    Rename to loadingOptions & loadingSelected for consistency?
  • Add filtering mechanism to picked options side
  • Cover new functionality with cypress tests
    • TECH-378
    • TECH-379
  • Discuss inconsistencies I found (require a breaking change..)
    • option + selected vs source + picked vs mixtures of the two
    • Props sourceEmptyPlaceholder & selectedEmtpyComponent
      • source & selected
      • Placeholder & Component
    • filtering props for the selected list end with Picked
      • Should it end with Selected?
      • Other props have Selected/Picked not at the end, but in the middle of the prop name
    • Some props use left/right, not option/selected (possible confusion once component has been adjusted to adapt to smaller screen sizes)

@Mohammer5 Mohammer5 requested a review from a team as a code owner July 28, 2020 14:35
@cypress
Copy link
Copy Markdown

cypress Bot commented Jul 28, 2020



Test summary

494 0 0 0


Run details

Project ui
Status Passed
Commit 13a1804
Started Aug 14, 2020 11:34 AM
Ended Aug 14, 2020 11:45 AM
Duration 11:07 💡
OS Linux Ubuntu Linux - 18.04
Browser Electron 80

View run in Cypress Dashboard ➡️


This comment has been generated by cypress-bot as a result of this project's GitHub integration settings. You can manage this integration in this project's settings in the Cypress Dashboard

@Mohammer5 Mohammer5 changed the title Transfer improvements feat(transfer): add requested improvements Jul 29, 2020
export const SourceOptions = ({
children,
dataTest,
sourceEmptyPlaceholder,
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For the PickedOptions this seems to be called selectedEmptyComponent, here it's sourceEmptyPlaceholder. I would expect them to have similar types of names.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I've listed some of the inconsistencies in the PR's description that we need to talk about and whether we want to introduce a breaking change

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah sorry, I missed that. 👍

Comment on lines +119 to +130
const actualFilter = onFilterChange ? searchTerm : internalFilter
const actualFilterCallback = filterable ? filterCallback : identity

const [internalFilterPicked, setInternalFilterPicked] = useState(
initialSearchTermPicked
)
const actualFilterPicked = onFilterPickedChange
? searchTermPicked
: internalFilterPicked
const actualFilterPickedCallback = filterablePicked
? filterCallbackPicked
: identity
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a bit unclear what's going on in this area.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've tried to make the code a bit more clear. Is it better now?

// observations within a single animation frame. It is benign (your site
// will not break).
//
// Source: https://stackoverflow.com/a/50387233/1319140
Copy link
Copy Markdown

@ghost ghost Jul 30, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I checked out the answer. While it might not be indicative of a problem in the usecase mentioned on stack overflow, it might be in our case? Lea Verou has posted a related issue in the Resize Observer spec repo here that's interesting: WICG/resize-observer#38. I would still be interested in what's causing the error exactly before we ignore it.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's working for now. I think we should investigate the exact cause, but for this PR I think it should be fine?

@ghost ghost self-requested a review July 30, 2020 09:33
Copy link
Copy Markdown

@ghost ghost left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I noticed it's a bit hard to review these changes since there are multiple issues being addressed in the PR. I know that I often do that myself as well, but as a reviewer it makes it harder to review properly, as it gets a bit confusing. Especially with an intricate component such as this.


import { EndIntersectionDetector } from './EndIntersectionDetector.js'

export const OptionsContainer = ({
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know we talked about the IntersectionDetector not working properly in some cases. I suspect that you've addressed that issue here with the resize observer? Or is it still an issue?

I think what I'd prefer as a reviewer to fix the intersection detector bug is a separate PR with a failing test as the initial commit. So that we can then test our solutions against that. From the reviewer's (or my) perspective that'd be a nice approach.

One other thing I'm still skeptical about with the IntersectionDetector component by the way is that the name is directly tied to the api. The way I see it, we're interested in detecting visibility. That's why I preferred VisibilityDetector in the other PR for this component, since it seemed like that was what it had to do.

Now instead of the function we've tied the naming to the api. And now that we're encountering issues where the api isn't fulfilling our needs of detecting visibility we can't fix it within the component, because it doesn't fit the scope of it. I think I'd still prefer a visibility detector component that neatly packages that functionality. That way we can just use that component to detect when the end of the list has been reached, and fix bugs within that component.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I've addressed it already. The problem with the visibility component in this case is, that the fix had to be done for a DOM element that's specific to the transfer.

I'd prefer to stay close to the actual api the component is implementing. The component is actually testing an intersection. The issue that came up wasn't an issue of the intersection detector alone, but it interacting with the resize observer.

I think the only possible solution I can think of is a VisibleContainer and a VisibilityDetector which have to be used in combination, as the setup will always be something like this:

container
  > some custom content
    > detector

The issue is that the detector needs to be a child of the custom content, which would increase the complexity of the component. I prefer to stick to the actual functionality of the component as it's clear what you can use it for. If we ever want to have some kind of visibility detector component, it should be separate of course

@Mohammer5 Mohammer5 force-pushed the Transfer_improvements branch from c0b4b71 to 0cacd43 Compare August 11, 2020 06:51
@martinkrulltott
Copy link
Copy Markdown
Contributor

Regarding the naming convention and possibly renaming props, I don't mind a breaking change to increase the consistency and to make it easier to use / understand. However, as the 2.35 soft freeze is only 2 weeks away and we've had issues with breaking changes in ui before, I'd prefer if we could refrain from breaking changes for the changes needed for the 2.35 release. Ping @janhenrikoverland for second opinion on BC's

@Mohammer5 Mohammer5 force-pushed the Transfer_improvements branch from 1612b91 to 74ff168 Compare August 14, 2020 11:08
@Mohammer5 Mohammer5 merged commit 5ccddf3 into master Aug 14, 2020
@Mohammer5 Mohammer5 deleted the Transfer_improvements branch August 14, 2020 13:44
@dhis2-bot
Copy link
Copy Markdown
Contributor

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants