Skip to content
This repository has been archived by the owner on Jan 11, 2023. It is now read-only.

fix problems introduced in text search #3640

Merged
merged 1 commit into from
Aug 12, 2017

Conversation

aklt
Copy link
Contributor

@aklt aklt commented Aug 12, 2017

Associated Issue: #3638

Note: There is a flow issue with this PR. Running yarn flow gives this error:

yarn flow v0.24.6
$ flow
Error: src/components/PrimaryPanes/SourcesTree.js:250
                      v------------
250:     const tree = ManagedTree({
251:       key: isEmpty ? "empty" : "full",
252:       getParent: item => {
...:
270:     });
         -^ function call
 38:   props: Props;
              ^^^^^ property `disabledFocus`. Property not found in. See: src/components/shared/ManagedTree.js:38
                                  v
250:     const tree = ManagedTree({
251:       key: isEmpty ? "empty" : "full",
252:       getParent: item => {
...:
270:     });
         ^ object literal


Found 1 error
error Command failed with exit code 2.

Which i cannot find a good solution to and I need some sleep. :-)

@codecov
Copy link

codecov bot commented Aug 12, 2017

Codecov Report

Merging #3640 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #3640   +/-   ##
=======================================
  Coverage   54.51%   54.51%           
=======================================
  Files         120      120           
  Lines        4786     4786           
  Branches      992      992           
=======================================
  Hits         2609     2609           
  Misses       2177     2177
Impacted Files Coverage Δ
src/components/shared/ManagedTree.js 5.26% <ø> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 7a3af46...cb2e38a. Read the comment docs.

{matches}
</span>
);
return dom.span({ className: "line-value" }, ...matches);
Copy link
Contributor

Choose a reason for hiding this comment

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

Why did you need to change this back?

Copy link
Contributor

Choose a reason for hiding this comment

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

You get this error when it's an array

    return (
      <span className="line-value">
        {matches}
      </span>
    );

screen shot 2017-08-12 at 9 45 03 am

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good question. There is an issue where <span>{matches}</span> causes a react
error that keys should be unique,.. oh! I see jasonLaster just commented about that :)

Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor

Choose a reason for hiding this comment

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

looks like there are some issues with spreading and it is a performance hit for react as well.
babel/babylon#42

With that in mind, lets merge this and then refactor matches properly

Here's a gist of a patch i started https://gist.github.com/jasonLaster/11e46330c6cc17b36c4f78cb3229fa30

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah, interesting, so using spreads for children is off the table for now I guess.

Thanks for the links

@@ -25,7 +25,7 @@ type Props = {
onExpand?: (item: any) => void,
onCollapse?: (item: any) => void,
renderItem: any,
disabledFocus: boolean
disabledFocus?: boolean
Copy link
Contributor

Choose a reason for hiding this comment

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

i don't know why this is needed now... but it looks good

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This was an attempt at making the prop optional to try and make the error mentioned in the PR
above go away. The disabledFocus prop is not used in src/components/PrimaryPanes/SourcesTree.js so it should be optional for now.

Unfortunately making it optional did not make yarn flow happy. I think this might be a known flow issue.

Copy link
Contributor

Choose a reason for hiding this comment

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

my flow is happy. and so is CIs so you're off the hook

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Gah! So there is something strange in my setup, grrr.

{matches}
</span>
);
return dom.span({ className: "line-value" }, ...matches);
Copy link
Contributor

Choose a reason for hiding this comment

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

You get this error when it's an array

    return (
      <span className="line-value">
        {matches}
      </span>
    );

screen shot 2017-08-12 at 9 45 03 am

Copy link
Contributor

@jasonLaster jasonLaster left a comment

Choose a reason for hiding this comment

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

👍

@jasonLaster jasonLaster merged commit 3282e9d into firefox-devtools:master Aug 12, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants