text:
Deprecate work item relationships that are not named after their field name in the WIT

We need to deprecate work item relationships in the JSONAPI that have a different field name in the work item type definition. For example, the planner item type defines a field called system.area which is placed as the relationship area in the work item response. The relationship needs to be called system.area to prepare for a much bigger change that comes after this issue: #2029 .
This is how I would mark the old relationships as [DEPRECATED] and how I would add the new ones:
$ git diff -- go/src/github.com/fabric8-services/fabric8-wit/design/workitems.go
diff --git a/design/workitems.go b/design/workitems.go
index c609ccbf..7bf0e826 100644
--- a/design/workitems.go
+++ b/design/workitems.go
@@ -33,13 +33,20 @@ var workItem = a.Type("WorkItem", func() {

 // WorkItemRelationships defines only `assignee` as of now. To be updated
 var workItemRelationships = a.Type("WorkItemRelationships", func() {
-       a.Attribute("assignees", relationGenericList, "This defines assignees of the Work Item")
-       a.Attribute("labels", relationGenericList, "List of labels attached to the Work Item")
-       a.Attribute("creator", relationGeneric, "This defines creator of the Work Item")
+       a.Attribute("assignees", relationGenericList, "[DEPRECATED] This defines assignees of the Work Item")
+       a.Attribute("system.assignees", relationGenericList, "This defines assignees of the Work Item")
+       a.Attribute("labels", relationGenericList, "[DEPRECATED] List of labels attached to the Work Item")
+       a.Attribute("system.labels", relationGenericList, "List of labels attached to the Work Item")
+       a.Attribute("creator", relationGeneric, "[DEPRECATED] This defines creator of the Work Item")
+       a.Attribute("system.creator", relationGeneric, "This defines creator of the Work Item")
+       a.Attribute("comments", relationGeneric, "[DEPRECATED] This defines comments on the Work Item")
+       a.Attribute("system.comments", relationGeneric, "This defines comments on the Work Item")
+       a.Attribute("iteration", relationGeneric, "[DEPRECATED] This defines the iteration this work item belong to")
+       a.Attribute("system.iteration", relationGeneric, "This defines the iteration this work item belong to")
+       a.Attribute("area", relationGeneric, "[DEPRECATED] This defines the area this work item belongs to")
+       a.Attribute("system.area", relationGeneric, "This defines the area this work item belongs to")
+
        a.Attribute("baseType", relationBaseType, "This defines type of Work Item")
-       a.Attribute("comments", relationGeneric, "This defines comments on the Work Item")
-       a.Attribute("iteration", relationGeneric, "This defines the iteration this work item belong to")
-       a.Attribute("area", relationGeneric, "This defines the area this work item belongs to")
        a.Attribute("children", relationGeneric, "This defines the children of this work item")
        a.Attribute("space", relationSpaces, "This defines the owning space of this work item.")
        a.Attribute("parent", relationKindUUID, "This defines the parent of this work item.")

The old ones shall still work until all clients, namely planner, have adopted to use the new system.XXX relationships. Until then just set the new relationships to the same value as the old ones.
Today I've talked to @xcoulon and @nimishamukherjee about this.

Please note that any member name (also the one of a relationship) must follow these rules in JSONAPI http://jsonapi.org/format/#document-member-names. One of the key takeaways is that the dot-character is a reserved character:

U+002E PERIOD, “.” (used as a separator within relationship paths)

That brings me to the conclusion that we possibly might want to safely migrate over to new field names altogether instead. @xcoulon , @aslakknutsen , @jarifibrahim do you agree? This bring us closer to JSONAPI compliance.
During migration we should follow this backwards compatible two-step approach for rolling updates: https://developers.redhat.com/promotions/migrating-to-microservice-databases/
Do you guys think it is fine to use system_title instead of system.title for example or do you want to get rid of the system altogether maybe?

@kwk

That brings me to the conclusion that we possibly might want to safely migrate over to new field names altogether instead. @xcoulon , @aslakknutsen , @jarifibrahim do you agree?

I'd suggest we gracefully deprecate the relationships. We mark the old relationships with [DEPRECATED] and then the client moves over to the new relationships. We can then get rid of the old ones.

Do you guys think it is fine to use system_title instead of system.title for example or do you want to get rid of the system altogether maybe?

We should not get rid of the system prefix. Right now, it won't make much difference but when we have all sort of custom types/fields, we'll need a way to know which ones are the system fields and which ones are user defined. system_title seems fine to me.

authors: jarifibrahim kwk


text:
Improve perf of calculating WIs in iteration

We're seriously wasting time in calculating numbers of work items in
iterations by ignoring the fact that we're in a space. @pbergene gave
me a dump of slow queries this morning and while I was looking for
something completely else I noticed this piece:
 "Query Text": "SELECT iterations.id as IterationId, count(*) as Total,\
\    \    \    count( case fields->>'system.state' when 'closed' then '1' else null end ) as Closed FROM \\"work_items\\" left join iterations\
\    \    \    on fields@> concat('{\\"system.iteration\\": \\"', iterations.id, '\\"}')::jsonb WHERE (iterations.space_id = $1\
\    \    \    and work_items.deleted_at IS NULL) GROUP BY IterationId",

This query is so slow (~55 to 60ms) that and it appears so often that
the log of slow queries is cluttered with this.
This change is supposed to address this by limiting the number of work
items that are queried to the current space. Also the counting is
simplified by using PostgreSQLs FILTER expression (see
https://www.postgresql.org/docs/9.6/static/sql-expressions.html).
No functionality should have been changed which is why all the test
should continue to work as expected.

Ike Plugins (test-keeper)
Thank you @kwk for this contribution!

It appears that no tests have been added or updated in this PR.
Automated tests give us confidence in shipping reliable software. Please add some as part of this change.
If you are an admin or the reviewer of this PR and you are sure that no test is needed then you can use the command /ok-without-tests as a comment to make the status green.
For more information please head over to official documentation. You can find there how to configure the plugin.

[test]

/ok-without-tests

@kwk This is something very interesting
postgres@localhost:postgres> SELECT iterations.id as IterationId, count(*) as Total, count(*) FILTER (WHERE fields->>'system.state' ILIKE 'closed') AS Closed FROM
                             "work_items" left join iterations on fields@>
                             concat('{"system.iteration": "', iterations.id, '"}')::jsonb WHERE
                             (work_items.deleted_at IS NULL) GROUP BY IterationId;
Time: 0.561s
postgres@localhost:postgres> SELECT iterations.id as IterationId, count(*) as Total, count(*) FILTER (WHERE fields->>'system.state' ILIKE 'closed') AS Closed FROM
                             "work_items" inner join iterations on fields@>
                             concat('{"system.iteration": "', iterations.id, '"}')::jsonb WHERE
                             (work_items.deleted_at IS NULL) GROUP BY IterationId;
Time: 0.053s

I ran the above query on a database with 337 Iterations and 1330 workitems. We should be inner join instead of left join unless there is good reason to use the later.

I ran the above query on a database with 337 Iterations and 1330 workitems. We should use inner join instead of left join unless there is good reason to use the later.

Thank you @jarifibrahim for this thorough review.I only saw the potential to clean up a small thing but this looks really good.

Thank you @jarifibrahim for this thorough review.I only saw the potential to clean up a small thing but this looks really good.

Yes yes. I just tried something and thought I should share the results.

source: gharchive/pull-request

authors: alien-ike jarifibrahim kwk

license_type: permissive

license_source: github-api


text:
Update ES plugin to 1.9.2

elasticsearch_dynamic is busted with 0.14.X, where X>0.
ES 1.9.2 fixes it with https://github.com/uken/fluent-plugin-elasticsearch/pull/224
As far as I can tell, this is the last blocker for me (us) to move away from fluentd 0.14.0.pre.1.
Perhaps, at some point, 0.14.8 could be replaced with 0.14.10, but this is already good enough.

Thanks!

authors: jimmidyson therc


text:
Update samples/quarkus

Description
Quarkus sample version is old
Info
https://quarkus.io

If it's a feature request, what is your use case :  Sampling latest version of Quarkus

@cricket007 : We're currently migrating project to Eclipse JKube. It's just the rebranded version of FMP. Could you please try out Quarkus quickstart there ?

Gotcha gotcha. Missed the note in the README
Can do

source: gharchive/issue


text:
Remove fa- namespacing from colours

This removes fa- namespacing from all colours in the utility library.
The namespacing was originally introduced for the colours to clearly flag them as being FreeAgent brand colours. But as the number of colours in the utilities has moved beyond our primary palette, and more designers and engineers have had experience of using the utilities, the namespacing has become unnecessary.
Removing the namespacing will also make it easier for other individuals or organisations to fork the utilities and add their own colour values without also having to manually remove our namespacing.
If the work on this branch is agreed by the team as being the right approach, this branch should be merged into https://github.com/fac/fa-css-utilities/pull/13. That branch should then be merged to master before a new v1.5.0 release is cut.
Example
Before
.MyComponent {
  @include background-color(fa-blue);
  @include border(thin, fa-green);
  @include text-color(fa-blue--dark);
}

After
.MyComponent {
  @include background-color(blue);
  @include border(thin, green);
  @include text-color(blue--dark);
}

I'm pretty much on board with this change. I've been trying to think of potential problems of not having the name space, but this is a pretty managed repo, so I don't think we're likely to run into any issues.

Closing PR, as the consensus for now (in offline discussions) is that the colours qualify as our brand colours, therefore the namespacing is a valid pattern.

authors: paddyduke robbiemanson

repo: fac/fa-css-utilities

license: mit

license_source: bigquery


text:
Build error with folly and fmt

I cloned and ran the build script on Ubuntu 18 and 20 but encountered the same error on both.

I also tried it in a docker container with the following Dockerfile to get the same error
FROM ubuntu:18.04
RUN apt-get update && apt install git sudo -y
RUN git clone https://github.com/facebook/CacheLib
WORKDIR CacheLib
CMD ["./contrib/build.sh", "-j"]

For fmt, the build error is being caused by, this commit: https://github.com/fmtlib/fmt/commit/3a951a66cb0fb53ff5a9d5ce9c77e05ef9d382ce
I think there needs to be either changes made in Cachelib to fix this, or somehow make it point to one of the previous version of fmt.

To Meta team: could you please share what is the rationale behind fetching the latest dependencies on every build? Did you consider setting some specific version of each dependency in build-package.sh (e.g. to the latest release) and just updating them when necessary?

Hello @igchor ,
We can divide the dependencies into two groups: everything before folly (i.e. packages which do not depend on folly: zstd, googlelog, googletest, googleflags, fmt, sparsemap), then folly and all packages that do depend on it (folly, fizz, wangle, fbthrift) .
folly itself does not have a "release" or "stable" version. It is always being updated.
folly is added as git submodule to cachelib (like in many other projects which use folly). The difference is: other projects can decide to pin the folly git-submodule to a specific commit, and leave it as-is for a long time (effectively making it "stable").
But cachelib is a Facebook/Meta project, and the internal code base always tracks the latest folly build (observe all the commits at https://github.com/facebook/CacheLib/commits/main which just say "updating submodules" - those are automatic).
And so, when you update cachelib (with git pull) you also update the folly submodule commit version. Then you need to rebuild folly. and then you need to rebuild the downstream packages (fizz/wangle/fbthrift) which depend on folly.
For the other packages, you'll notice we do use a specific git tag or branch ( e.g https://github.com/facebook/CacheLib/blob/main/contrib/build-package.sh#L120 ). So those, even though we do a "git pull", it should remain in the same commit, and a make should be very fast.
I notice fmt is an exception - not pinned to a specific git tag or revision - likely an omission that can be fixed.
Hope this answered your question.
regards,
-assaf

Not sure if this was already cleared up (I'm assuming not since I ran into the same issue when reinstalling Cachelib today), but I managed to get around the folly build issue by doing ./contrib/build-package.sh -d. Definitely doesn't address the issue within the build script though...
Still in the midst of installation, so there may or may not be further issues down the line that I haven't encountered yet doing it this way.

authors: agordon ankita-shankar igchor pbhandar2 vereimyst

repo: facebook/CacheLib


text:
v2 secondary mobile nav?

Is this implemented yet? Can I implement this on my own? I want something like v1 for mobile. I would settle for a select input tbh.

@jaredpalmer coming soon #1562

See it here https://deploy-preview-1562--docusaurus-2.netlify.com/docs/introduction/
If you want to customize, swizzle is an option later on

authors: endiliey jaredpalmer

repo: facebook/Docusaurus

license: MIT


text:
Sass global styles including mixins

I'm using the alpha release https://github.com/facebook/create-react-app/issues/3815 to give the sass feature a try.
I like using bootstrap 4 and just generally use the grid and implement this using the mixins.
When i add these to App.scss i get "No mixin named make-col-ready"
`
.App-test {
@include make-col-ready();
@include make-col(12);
@include media-breakpoint-up(md) {
    @include make-col(6);
    @include make-col-offset(3);
}

@include media-breakpoint-up(lg) {
    @include make-col(5);
    @include make-col-offset(0);
}

}`
Now if i add an @import to the top of my components scss "@import './sass/bootstrap.scss'; its works.
But this doesn't feel that clean and would prefer to reference it once and automatically have it included to be available through out the components scss files. Is using @import the recommended way? Or
a m i right in thinking i would need to eject and customise with a loader to make these available through out my project?

From personal experience, you have to import what you need as you need it - much like you would with the javascript part of your app.
As long as the thing you're importing doesn't dump any actual styles in the page ( just placeholders, mixins and variables etc.) I don't think there's any downsides to importing per sheet.

@DanProudfoot I have helper classes and resets e.g
`@mixin text-hide() {
display: block;
overflow: hidden;
text-indent: -9000px;
}
.u-text-hide {
@include text-hide;
}`
So my understanding is @mixin will only get added when used, but .u-text-hide would get added every time i import the globals. So if i have 3 components on the screen it will be duplicated.
Is that right?

Hey, sorry for the long wait.
The first bit you've got right.
With the image, I would still have a base stylesheet - maybe pulled in your index.js file - it can be a standard .scss (without .module.scss) and just define global rules etc just that once.
There may be better methods, but this is what I find most helpful

Sounds like this was resolved.

authors: DanProudfoot Timer adamwright104

repo: facebook/create-react-app


text:
How to configure Postcss autoprefixer not to remove css property

Is this a bug report?
Yes

Did you try recovering your dependencies?
Yes

Which terms did you search for in User Guide?
CSS, Postcss, autoprefixer

Environment
  System:
    OS: macOS 10.14
    CPU: x64 Intel(R) Core(TM) i5-7500 CPU @ 3.40GHz
  Binaries:
    Node: 11.0.0 - /usr/local/bin/node
    npm: 6.4.1 - /usr/local/bin/npm
  Browsers:
    Chrome: 72.0.3626.119
    Safari: 12.0
  npmPackages:
    react: ^16.8.2 => 16.8.2
    react-dom: ^16.8.2 => 16.8.2
    react-scripts: 2.1.5 => 2.1.5
  npmGlobalPackages:
    create-react-app: Not Found

Steps to Reproduce

Configure browserslist in packages.json as belowbrowserslist": [
    "Android > 0",
    "iOS > 0",
    "FirefoxAndroid > 0",
    "Chrome > 0",
    "Safari > 0"
]

Add styles in App.modules.css  for multiline ellipsis.app {
   display: -webkit-box;
   overflow: hidden;
   text-overflow: ellipsis;
   -webkit-line-clamp: 2;
    -webkit-box-oreint: vertical;
}

Run the project using npm run start
Postcss removes -webkit-box-orient property

Expected Behavior
.app {
    display: -webkit-box;
    overflow: hidden;
    text-overflow: ellipsis;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

Postcss to add CSS prefixes where needed, without removing property
Actual Behavior

.app {
    display: -webkit-box;
    overflow: hidden;
    text-overflow: ellipsis;
    -webkit-line-clamp: 2;
    // -webkit-box-orient: vertical; --> this gets removed, can't get the multiline ellipsis working :(
}

-webkit-box-orient:vertical seems like the only thing to get the multiline ellipsis using CSS.
(https://css-tricks.com/almanac/properties/l/line-clamp/)
Also tried  box-orient: vertical  but it doesn't get prefixed.
Found https://github.com/postcss/autoprefixer#control-comments, but I'd like to know if there is any other way to configure in package.json not to remove ANY css property.

Reproducible Demo

To answer your question, the only control we currently offer is through browserslist. This sounds like a bug in autoprefixer. I'd recommend filing a bug with them. If they fix it let us know and we can upgrade!

Thanks for your reply :) at least now it's clear..!
autoprefixer doesn't seem so keen to update it according to their answers to the issue. 😢
Would there be any plan to add control to override autoprefixer option in the default webpack.config.js via package.json?
// webpack.config.js from react-scripts
{
        loader: require.resolve('postcss-loader'),
        options: {
          ident: 'postcss',
          plugins: () => [
            require('postcss-flexbugs-fixes'),
            require('postcss-preset-env')({
              autoprefixer: {
                flexbox: 'no-2009', // --> This is removing the property
              },
              stage: 3,
            }),
          ],
          sourceMap: isEnvProduction && shouldUseSourceMap,
        },
},

Would you be able to link me to the issue? You're saying that the flexbox setting is stripping out your property?

Yes the setting is removing the property. Would be appreciated if you can look into it!

Here is the link to the same issue -> https://github.com/postcss/autoprefixer/issues?utf8=✓&q=box-orient
And to the answer that they will keep it this way -> https://github.com/postcss/autoprefixer/issues/1141

Any news?

I'm not sure there's much we can do on our end. We don't want to remove the no-2009 setting as we only want to be prefixing final spec properties of flexbox, nor do we want to expose autoprefixer options at this time.
I think the best solution for now is to use control comments as suggested here: https://github.com/postcss/autoprefixer/issues/1141#issuecomment-431280891.

authors: ianschmitz keipark mahnunchik


text:
Fix Server Side rendering support

This resolve issue #44.
I moved all the translateDOMPositionXY calls inside comoponentDidMount and componentDidUpdate.
The site dev server works and my server rendering don`t throw the warning.

Hey @marduke182, thanks for the PR. The way i was thinking about in the past to solve this was to have some state that tells us we are in the first pass and always render positions with left and top (since we know all browsers support this but not translate pos), then on any other render from there we can use the fancy translate3d stuff. See the inline message for why i think the current approach in this PR is bad. Do you think you would be able to update this to do that?

Hi @pieterv, My first solution was use the state to store a flag variable, and in componentDidMount change the state to know that the component was mounted. But in the best practice says that never use setState inside componentDidMount. I update the pull request to show you my original solution.
Maybe the best way is use Hight Order Component to control the state of initialRender and pass by a property the argument.
Thanks for the feedback.

Hmm i dont think this flag necessarily needs to live on state, since we don't actually want to force a render as a result of changing it, we just need a flag to signify that we are now out of the first render. The down side of this is it will make the render more non-pure, but it wont be to much worse than it already was (since it already relies on global state).
so:
componentDidMount() {
  this._initialRender = false;
}

Lets also create a wrapper around translateDOMPositionXY module that does this logic (translateDOMPositionXY is hard for us to change since its a core FB module), so if is this._initialRender then use left and top then after this we just delegate to translateDOMPositionXY.
Thanks for taking this on!

I update the pull request with the final solution. All the modules affected have this change:
componentWillMount() {
  this._initialRender = true;
}

componentDidMount() {
  this._initialRender = false;
}

And wrap  translateDOMPositionXY, like you said.

I'm quite interested in this... any chance we can get it merged?

+1 - Second @tbrd - would love to get this merged

it would be great to have this pull request merged

:+1:

:+1:

(Y)

@marduke182 Thanks for the awesome pull requests, I've merged your fork into some of our code.  Though it seems like there a whole bunch of other things that still don't work with SSR.
e.g. The height is a dynamic value -> https://github.com/listium/fixed-data-table/blob/ssr/src/FixedDataTableColumnResizeHandle.react.js#L119
There a bunch of other small ones I've been band aiding. I wonder if it is time for a fork to really get SSR working?

Also a good solution to making all rows initially appear for SEO purposes would be great.

@pieterv Do you have a plan merge this request?

@tbrd @HillLiu @DenLilleMand @djbobbydrake we've merged the PR for this into our fork at https://github.com/schrodinger/fixed-data-table-2 and should have the fix up on npm within a week.
@thomasdavis If you open an issue or PR with the SSR issues you're seeing, we'd appreciate your help getting it stable on our fork.  Thanks!

authors: AlesJiranek DenLilleMand HillLiu djbobbydrake marduke182 pieterv tbrd thomasdavis wcjordan

repo: facebook/fixed-data-table


text:
Flow 0.6.0 breaks Q declarations

My q.js declarations file, produced by @gabelevi himself, works fine in flow 0.5.0. When I update to flow 0.6.0, I get the following errors:
/Users/danvk/github/pileup.js/lib/q.js: inconsistent use of library definitions
  /Users/danvk/github/pileup.js/lib/q.js:167:26,42: function type
Too few arguments (expected default/rest parameters in function)
  /Users/danvk/github/pileup.js/lib/q.js:170:26,64: function type

/Users/danvk/github/pileup.js/lib/q.js: inconsistent use of library definitions
  /Users/danvk/github/pileup.js/lib/q.js:167:26,42: function type
This type is incompatible with
  /Users/danvk/github/pileup.js/lib/q.js:170:26,64: polymorphic type: function type

/Users/danvk/github/pileup.js/lib/q.js: inconsistent use of library definitions
  /Users/danvk/github/pileup.js/lib/q.js:167:26,42: function type
Too few arguments (expected default/rest parameters in function)
  /Users/danvk/github/pileup.js/lib/q.js:173:26,193: function type

/Users/danvk/github/pileup.js/lib/q.js: inconsistent use of library definitions
  /Users/danvk/github/pileup.js/lib/q.js:167:26,42: function type
This type is incompatible with
  /Users/danvk/github/pileup.js/lib/q.js:173:26,193: polymorphic type: function type

Found 4 errors

The three lines coming up in the error are these:
declare function when(): Promise<void>;
declare function when<T>(value: T | IPromise<T>): Promise<T>;
declare function when<T, U>(value: T | IPromise<T>, onFulfilled: (val: T) => U | IPromise<U>, onRejected?: (reason: any) => U | IPromise<U>, onProgress?: (progress: any) => any): Promise<U>;

Did something about declaring overloading functions change in the 0.5.0→0.6.0 update? Or maybe the error was occurring all along and it's been "unsuppressed"? :)

Apparently the latter. You can work around by adding (possibly redundant) <T,U> to the other declarations. Will update when fixed.

Thanks @avikchaudhuri. Adding <T, U> to all declarations made the error go away.

authors: avikchaudhuri danvk

repo: facebook/flow


text:
flow seems to be confused by function declaration

Below are two examples, first one works as expected while the second (I believe incorrectly) does not:
/* @flow */

export const run = (task:?Function) => {
  if (task != null)  {
    task()
  } else {
    throw TypeError("task must be a function")
  }
}

The following example fails with "function call Function cannot be called on possibly null value" error.
/* @flow */

const run = (task:?Function) => {
  if (task != null)  {
    const run = () => {
      return task()
    }

    run()
  } else {
    throw TypeError("task must be a function")
  }
}

Yea, this is a KP (see http://flowtype.org/docs/dynamic-type-tests.html#caveats)
It's because, at the moment, having a function call inside a refinement will invalidate Flow's certainty about that refinement (Flow isn't currently able to follow the function call and confirm that it doesn't change the value of task back to null by way of some other closure).
For now you can work around this for now by saving the refined variable to a different local var first inside the toplevel of the environment like this: https://gist.github.com/jeffmo/ca3323170edb7bcbd0a7

Yea, this is a KP (see http://flowtype.org/docs/dynamic-type-tests.html#caveats)

It's because, at the moment, having a function call inside a refinement will invalidate Flow's certainty about that refinement (Flow isn't currently able to follow the function call and confirm that it doesn't change the value of task back to null by way of some other closure).

Well in the mentioned caveat it makes sense because passed object can be mutated by an outer function. But the provided example outer function can't possibly change argument that is function to null or undefined so I think flow could handle that case without necessarily follow function calls.
@jeffmo Presume flow assumes that any function call may have unpredictable side effect and type can can change from anything to anything which is not great but in that case I would argue that following example should work fine (which is closer to my actual code in fact):
/* @flow */

const run = (task:?Function) => {
  const safeTask = task;
  if (safeTask != null)  {
    const run = () => {
      return safeTask()
    }

    run()
  } else {
    throw TypeError("task must be a function")
  }
}

In this case const safeTask  = task  should be refined to Function and invoking a function should have no effect given that const is used and there for it should not be possible to change safeTask value.

@Gozala The caveats section calls this out specifically.

Flow does not currently perform mutation analysis, so in some cases, Flow will throw away a refinement that is always safe to keep. As more analyses are implemented, Flow will hopefully come to understand the following examples are sound.

You're also right that const is more low-hanging fruit when it comes to keeping refinements. Investigating whether it is worthwhile to special-case const is on my radar already.

authors: Gozala jeffmo samwgoldman


text:
Parameters<> does not support optional params

declare type F = (s: string, n?: number) => boolean;
type Tuple = Parameters<F>;
declare function g(...args: Parameters<F>): boolean;
g("hi")

Cannot call g because rest array [1] has 1 element but tuple type [2] has 2 elements. [invalid-tuple-arity]
Flow version: master
Expected behavior
Type is tuple with optional arity
Actual behavior
Tuple is fixed length

Link to Try-Flow or Github repo:
Flow
typescript

Reduced example so we can see this more clearly: link
It seems a result of Flow forgetting that the element is optional after inference, and reduces it to T | void instead.

Hi. I did some investigation on this and make some attempts to fix it, but unfortunately the root of the issue is harder to address than I anticipated.
An obvious fix is to track the optionality properly. However, function types don't enforce similar optionality check like tuple types. Due to utility types like this that can easily convert between function params and tuple types, the connection is deep enough that we have to fix both at once, otherwise you will get some confusing errors elsewhere.


text:
--findRelatedTests Configuration

Hey, I already tried to get some help on Stack Overflow, but without success yet.
Is there a way to configure the behavior of --findRelatedTests? When I edit a JSON file with breaking changes, --findRelatedTests won't find .jsx? files, that are importing the broken JSON files. However jest --watch finds them correctly.
I'm using --findRelatedTests in my pre-commit Hook.
Let me know if you need more information about my setup. I keep also the SO question up2date.
Thank you!

Sounds like a bug! Can you use a proper template and provide a repro we can download?

Thanks for the quick response. You can find a minimal working example here: https://github.com/oleblaesing/jest-find-related-tests

can we have --findRelatedTests or another flag that return a list of tests to be run?

any news @thymikee ?

seems to be still actual

authors: hallya oleblaesing sibelius skyboyer thymikee

repo: facebook/jest


text:
Upgrade to prettier 1.6

Summary
Upgrade prettier to the latest 1.6.1 release. (I'm really loving this release)
This is separate from #4425 as I think this is safe to land on its own, while that PR might need to cook some.

Test plan
yarn lint

Codecov Report

Merging #4426 into master will increase coverage by <.01%.
The diff coverage is 53.33%.

@@            Coverage Diff             @@
##           master    #4426      +/-   ##
==========================================
+ Coverage   56.84%   56.84%   +<.01%
==========================================
  Files         191      191
  Lines        6472     6475       +3
  Branches        6        6
==========================================
+ Hits         3679     3681       +2
- Misses       2790     2791       +1
  Partials        3        3

Impacted Files
Coverage Δ

packages/jest-diff/src/diff_strings.js
100% <ø> (ø)
:arrow_up:

...ages/jest-config/src/reporter_validation_errors.js
16.66% <ø> (ø)
:arrow_up:

.../src/legacy_code_todo_rewrite/jest_adapter_init.js
0% <0%> (ø)
:arrow_up:

...ckages/jest-cli/src/reporters/coverage_reporter.js
54.9% <0%> (ø)
:arrow_up:

packages/jest-util/src/get_console_output.js
0% <0%> (ø)
:arrow_up:

packages/jest-jasmine2/src/setup_jest_globals.js
0% <0%> (ø)
:arrow_up:

packages/jest-editor-support/src/Runner.js
72.22% <100%> (ø)
:arrow_up:

packages/jest-message-util/src/index.js
86.58% <100%> (+0.16%)
:arrow_up:

...ackages/pretty-format/src/plugins/react_element.js
100% <100%> (ø)
:arrow_up:

packages/jest-runtime/src/script_transformer.js
89.92% <100%> (ø)
:arrow_up:

... and 1 more

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 1517391...8bb3a84. Read the comment docs.

Thank you!

authors: SimenB codecov-io cpojer


text:
Notion-like Toggle Plugin

Discussed in https://github.com/facebook/lexical/discussions/1835

Originally posted by gutenye April 18, 2022
Like below. Would love to see an example made into Playground. Thanks
https://user-images.githubusercontent.com/377544/163746866-7f479034-e675-42d9-98ab-6f20b0c9a3b9.mp4

That's an interesting one! The implementation is really attached to its requirements. For example, can it have siblings? How should text deletion work?
In the case of Notion it seems like it it behaves very similarly to ListNode so I can see two approaches:
ElementNode
The most accessible and cross-front-end framework approach is to write your own ElementNode that displays the arrow, has some padding and some TextNode inside it.
The ElementNode afterInsert will render these hidden item nodes, and the arrow click handler will change their visibility (rather than create-delete that would not show in the EditorState and would be bad for export and collab)
DecoratorNode
DecoratorNode is not necessarily a bad approach is there's lots of custom CSS involved. In the case the DecoratorNode would handle the handle the first line and the arrow and would render another editor inside it.

@zurfyx I've created an example code using ElementNode. Can you please take a look?

Does the code have anything to improve or is there a better way? (As I'm new to Lexical)
How to prevent the backspace key to delete the arrow icon? (I don't want the ToggleNode to be deleted)
Is this the correct way to pass a LexicalNode to a Component?

Thanks
https://codesandbox.io/s/lexical-togglenode-0ct1mm

authors: gutenye zurfyx

repo: facebook/lexical


text:
Webview get html content

Hello everyone, I know that this's not a Issue, but is there a way of getting the html content of the rendered view in the Webview?
I posted here because I can't find anything on google or stackoverflow

@facebook-github-bot stack-overflow

If you want the html from the url, you could fetch it without a webview.
If it's really the rendered html from the webview you want, I suppose you could inject a javascript function that fires on load end, and posts the DOM content.

@alexsotocx  i want the same thing , have you got any solution ? can you please paste your solution ?

+1 same thing.

+1

authors: DeliDoktoru HimaniLathiya alexsotocx damusnet ducpt2

repo: facebook/react-native


text:
Documentation: AsyncStorage docs missing vital details

https://facebook.github.io/react-native/docs/asyncstorage.html
Vital questions that remain unanswered:

Format of error objects: possible error codes
What happens when I try to "set" an item that already exists? Will it silently overwrite or raise an error?
What happens when I try to "get" an item that does not exist? undefined, null or error?

I'm trying to convert node.js code that relies on ndoe.js "fs" module API details like the above, like not overwriting existing files unless "force"-d, or raising an error when trying to access a non-existent file, and I will have to run experiments to try to find out the react-native behavior (which on a laptop and the slow device emulator is quite a chore). This should have been in the documentation.

As the current documentation code examples hints, if you try to get an item that doesn't exist, you get null instead.
try {
  const value = await AsyncStorage.getItem('@MySuperStore:key');
  if (value !== null){
    // We have data!!
    console.log(value);
  }
}

You can confirm this by looking at the source of AsyncStorage.js, line 84:
var value = (result && result[0] && result[0][1]) ? result[0][1] : null;

As for setting items, the storage engine used depends on what the currently running device has available (see the same file, line 19), however they should all silently overwrite items as far as I'm aware.
Perhaps someone else can chime in on the error formats.

Hi there! This issue is being closed because it has been inactive for a while. Maybe the issue has been fixed in a recent release, or perhaps it is not affecting a lot of people. Either way, we're automatically closing issues after a period of inactivity. Please do not take it personally!
If you think this issue should definitely remain open, please let us know. The following information is helpful when it comes to determining if the issue should be re-opened:

Does the issue still reproduce on the latest release candidate? Post a comment with the version you tested.
If so, is there any information missing from the bug report? Post a comment with all the information required by the issue template.
Is there a pull request that addresses this issue? Post a comment with the PR number so we can follow up.

If you would like to work on a patch to fix the issue, contributions are very welcome! Read through the contribution guide, and feel free to hop into #react-native if you need help planning your contribution.

authors: Etheryte hramos lll000111


text:
After react native upgrade to 0.44.2 InteractionManager runAfterInteractions not fired.

After upgrade react native version 0.42.0 to 0.44.2 InteractionManager runAfterInteractions method doesn't work not even called.
Trying to call after componentDidMount.
componentDidMount() {
InteractionManager.runAfterInteractions(() => {
this.setState({
interactionsComplete: true});
})
}
React Native version: 0.44.2
Platform: Android
Development Operating System: Linux
Dev tools: Android Studio version,Android SDK version

+1

+1

+1

how to solve the problem？

authors: AkilLis dioxide lyxia mjylfz rocwangv


text:
Question: auto height

Help pls,
how to set auto height of parent view. i have a native ad UI implemented by java.  code something like
<AdsView
style={{width:'100%'}}
/>
problem is ad does not display for height issue. when i manually add height:350 in style that time ad displayed.
question is how to set auto height in this case...
my java code
`public class NativeAdView extends FrameLayout {
@Override
public void requestLayout() {
super.requestLayout();
    // The spinner relies on a measure + layout pass happening after it calls requestLayout().
    // Without this, the widget never actually changes the selection and doesn't call the
    // appropriate listeners. Since we override onLayout in our ViewGroups, a layout pass never
    // happens after a call to requestLayout, so we simulate one here.
    post(measureAndLayout);
}

private final Runnable measureAndLayout = new Runnable() {
    @Override
    public void run() {
        measure(MeasureSpec.makeMeasureSpec(getWidth(), MeasureSpec.EXACTLY),
               MeasureSpec.makeMeasureSpec(getHeight(), MeasureSpec.EXACTLY));
        layout(getLeft(), getTop(), getRight(), getBottom());
    }
};

private void refreshAd(NativeAdView v) {
    if (TextUtils.isEmpty(admobAdUnitId)) {
        admobAdUnitId = ADMOB_AD_UNIT_ID;
    } else {
        Log.d(TAG, "admobAdUnitId is not null");
    }
    AdLoader.Builder builder = new AdLoader.Builder(getContext(), admobAdUnitId);

    builder.forUnifiedNativeAd(new UnifiedNativeAd.OnUnifiedNativeAdLoadedListener() {
        @Override
        public void onUnifiedNativeAdLoaded(UnifiedNativeAd _unifiedNativeAd) {
            if (_unifiedNativeAd != null) {
                // You must call destroy on old ads when you are done with them,
                // otherwise you will have a memory leak.
                if (_nativeAd != null) {
                    _nativeAd.destroy();
                }
                _nativeAd = _unifiedNativeAd;
                LayoutInflater layoutInflater = LayoutInflater.from(__context);
                View viewRoot = layoutInflater.inflate(R.layout.ad_unified, null);
                //if(unifiedNativeAdView!=null) {
                    // unifiedNativeAdView.removeAllViews();
                    // v.removeAllViews();
                //}
                unifiedNativeAdView = (UnifiedNativeAdView)viewRoot;//(UnifiedNativeAdView) viewRoot.findViewById(R.id.unified_ad_view);
                //v.addView(unifiedNativeAdView);
                populateUnifiedNativeAdView(_unifiedNativeAd);
                v.removeAllViews();
                v.addView(viewRoot);
                Log.d(TAG, v.getMeasuredHeight () + " " + unifiedNativeAdView.getMeasuredHeight());
                // v.requestLayout();
                // printNativeInfo(_unifiedNativeAd);
            }
            sendEvent(AdsViewManager.EVENT_UNIFIED_NATIVE_AD_LOADED, null);
        }
    });

.....................
.........................
}`

Have you tried using flexbox? Alternatively, you can use the Dimensions api to get the device height and then size your component accordingly. Something like this,
import { Dimensions } from 'react-native';

const ScreenHeight = Dimensions.get('window').height;

<AdsView
style={{ height: ScreenHeight }}
/>

I dont know native ad height. it may be 350 , 330 or something else. in that case how to handle height in react native end.

authors: farshed sharifashraful


text:
error: default initialization of an object of const type 'const folly::sorted_unique_t'

i was gotten this error and it has taken 2 days :

error: default initialization of an object of const type 'const folly::sorted_unique_t'  without a user-provided default constructor

With this error information :

Folly/folly/Demangle.cpp normal i386 c++ com.apple.compilers.llvm.clang.1_0.compiler

It cause when i run :

react-native run-ios --simulator="iPhone 6 Plus" --configuration Release

My dependencies :
CocoaAsyncSocket (7.6.3)
DoubleConversion (1.1.6)
FBLazyVector (0.63.4)
FBReactNativeSpec (0.63.4)
Flipper (0.41.5)
Flipper-DoubleConversion (1.1.7)
Flipper-Folly (2.5.1)
Flipper-Glog (0.3.6)
Flipper-PeerTalk (0.0.4)
Flipper-RSocket (1.3.1)
FlipperKit (0.41.5)
Folly (2020.01.13.00)
OpenSSL-Universal (1.1.180)
RCTRequired (0.63.4)
RCTTypeSafety (0.63.4)
RNCMaskedView (0.1.10)
RNGestureHandler (1.10.3)
RNReanimated (1.13.3)
RNScreens (2.18.1)
RNVectorIcons (8.1.0)
React (0.63.4)
React-Core (0.63.4)
React-CoreModules (0.63.4)
React-RCTActionSheet (0.63.4)
React-RCTAnimation (0.63.4)
React-RCTBlob (0.63.4)
React-RCTImage (0.63.4)
React-RCTLinking (0.63.4)
React-RCTNetwork (0.63.4)
React-RCTSettings (0.63.4)
React-RCTText (0.63.4)
React-RCTVibration (0.63.4)
React-callinvoker (0.63.4)
React-cxxreact (0.63.4)
React-jsi (0.63.4)
React-jsiexecutor (0.63.4)
React-jsinspector (0.63.4)
ReactCommon (0.63.4)
Yoga (1.14.0)
YogaKit (1.18.1)
boost-for-react-native (1.63.0)
glog (0.3.5)
libevent (2.1.12)
react-native-safe-area-context (3.2.0)
Can someone help me fix this, thank you all !

Closed as invalid (not following the issue template)

authors: cortinico ductridev


text:
requiring npm modules fails

Was hoping to try out using something like request or superagent (as suggested in docs) to handle network calls, but when I npm install -S them, I get requiring unknown module [MODULE_NAME] for both superagent and request. Could it be that the deps for each required module aren't being recursively looked at? Is this expected behavior And, furthermore, is there a best way to go about requiring modules for React-Native specifically that would differ from a more straightforward/typical JS use-case?
example thrown error for require('request') or related npm modules

For this specific case you'll likely want to use the fetch API which is provided by the environment. React Native does not run inside of the node runtime.

Yeah, had a major "doh" moment after posting. But superagent and most browser friendly modules should work, no?

I'm having this issue trying to require fluxxor. After doing npm install fluxxor

What? Isn't it supoorted to use ordinary npm modules şna  react native project by simply npm installing.
For example npm install socket.io.

It is, but not the ones that rely on a node runtime environment.

Huh! Thanks, I am really relaxed, serious.

What was the problem when you were installing superagent or request?

Was this resolved?

@markthethomas then how do i use other modules like lodash or xml2js?

@isikfsc The problem when I installed request was that it used dependencies like require('os') or require('crypto') that were simply not there, since the environment was not a node environment.

authors: SudoPlz aackerman chetstone isikfsc maluramichael markthethomas niftylettuce


text:
Certain styles applied together peg CPU

While working on my markdown module, I ran into a situation where my simulator CPU would jump to 160%+ and would (obviously) freeze the app. I found this behaviour particularly strange because the only thing I was doing was inserting React elements into the virtual DOM.
I thought perhaps there was a parsing bug that was causing a huge tree to be rendered, but upon further investigation I found I could repeat the issue with plain text inside my Markdown tag. The issue was only coming up after a certain number of letters were entered. That initial assumption was wrong though.
What seems to be happening is when a Text element exceeds the available width of its containing View, a bug causes the app to freeze up. This is more difficult to explain than it is to show, here's the code: (For reference, I was using 0.3.11 the iPhone 6 simulator, so the 375 width is relevant.)
<View style={{padding: 15, width: 375}}>
  <View style={{
    marginTop: 10,
    marginBottom: 10,
    flexWrap: 'wrap',
    flexDirection: 'row',
    alignItems: 'flex-start',
    justifyContent: 'flex-start'
  }}>
    <Text>
      xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
    </Text>
  </View>
</View>

@lwansbrough @vjeux and I looked into this in irc, fix for anyone else that comes across it is to use flex: 1 on the text node. This issue occurs when you have flexWrap: wrap and flexDirection: row on a parent of a text node.

The infinite loop is caused inside of the layout algorithm: https://github.com/facebook/css-layout if anyone is interesting in debugging it

Also, screenshot of the thread that is getting caught in an infinite loop while doing layout:

It appears flex: 1 offers a very different behaviour than what's offered by flexDirection: 'row' + flexWrap: 'wrap'. This bug has already been resolved upstream in https://github.com/facebook/css-layout/blob/master/src/Layout.js -- the React Native team just has to pull down those changes.

Any news on this?

@jmstout - this works now, no longer causes CPU to be pegged thanks to syncing css-layout in this commit: af921542b5f0be2a96f169cf397c530e4968a3f8

but it also a bug, when I run , the app cpu hit 100%

Not sure if this is considered the same bug or a new one, but when I:

have a scene using flexWrap: 'wrap' and flexDirection: 'row',
use Navigator to transition away
then try to transition back

The Navigator never transitions back and the CPU runs off. If I remove the flexWrap and flexDirection rules, everything works fine and I can transition between those screens with no problem.

authors: brentvatne jmstout lwansbrough rxb soliury vjeux


text:
if "request.build" support below

for example：
Builder build = new Builder().url(url);
build.localAddress(new InetSocketAddress(tempIp, 0));
SocketAddress sa = new InetSocketAddress(host,port);
Proxy proxy = new Proxy(Proxy.Type.HTTP, sa);
build.proxy(proxy);
Request request = build.build();
if "request.build" support above, i think the "okhttp" will be flexible.

sorry .this issues is for okhttp3.

As you have pointed out this is not an issue with React Native but okhttp3 instead I will close this issue. Thanks!

@facebook-github-bot close

@rmevans9 tells me to close this issue. If you think it should still be opened let us know why.


text:
Fail gracefully for node<4 in react-native-cli (const->var)

const declarations were recently introduced into https://github.com/facebook/react-native/blob/master/react-native-cli/index.js, which runs before any transpilation so needs to be old-school. Replace them with var.
Fixes https://github.com/facebook/react-native/issues/11603

I don't see why this should be necessary. There is an engines key in the package.json of react-native-cli which specifies "node": ">=4". As far as I know even node 4.0.0 supports const declarations.

True, but a check for that is made at the end of 'run' by 'checkNodeVersion', where we fail gracefully with a helpful message if the requirements aren't met. As it is, the script crashes out before we get that far.

This is not the same thing. checkNodeVersion refers to the engines key of the package.json at REACT_NATIVE_PACKAGE_JSON_PATH which is react-native's package.json and not react-native-cli's.
They are the same at the moment but is sure for the time to come?
That aside. If you are correct and react-native-cli should always run to fail gracefully if react-native's node requirements aren't fulfilled. Doesn't that mean that react-native-cli's engines key should be set to an earlier version or get removed?

Sorry, yes you're right - I was jumping to conclusions based on the fact that var is used throughout the rest of the file. https://github.com/facebook/react-native/commit/72b713262fbb84a0606260c4d8879621a3c7f8e7 suggests the CLI deliberately dropped support for node<4 so that we could use newer language features from then on.
The engines key is advisory so I think it's legitimate to install but fail gracefully on older versions. https://github.com/facebook/react-native/issues/11603 demonstrates that the engines config alone isn't enough to make it clear to everyone what the problem is, so I guess the options are:

Retain enough support to fail gracefully (ideally checking against the CLI's engines setting).
Move forward and accept that users of old node versions will get a bad experience  (although note 0.12 is only just leaving LTS). Anyone familiar with ES6 should probably figure out the problem themselves anyway.

(Aside: I guess maybe people are running into this issue because the Getting Started guide doesn't mention that homebrew might need updating)

I think this means @ide's opinion on this could be interesting.

The intent of the version check is to make it really clear and helpful to people running old versions of Node that they are using a too-old version and what they can do to upgrade (moving forward we'll probably require Node 6 soon). The "engines" field in package.json isn't enough since people don't always see the warning message when running npm install since it's buried in other console output.
So what we want to do is have a small JS file that is compatible with ES5 and checks the Node version. This ES5 file then will load other files that rely on modern Node.

small JS file that is compatible with ES5

Assuming you're referring to index.js, I take it you're in favour of this PR @ide?
If so I'm happy to add a note in the comment block indicating that it's intended to stay ES5 compatible. I hesitate because your first reason in https://github.com/facebook/react-native/commit/72b713262fbb84a0606260c4d8879621a3c7f8e7 only really applies if you intend to allow ES6 within  index.js itself, since anything passed on to the local CLI is guarded by checkNodeVersion anyway.

@rh389 Can you add a comment that says this file should be es5 compatible so it can warn about old node versions.

@janicduplessis Done - that ok?

@shergin I guess this got stuck?

authors: Fahrradflucht ide janicduplessis rh389


text:
Fix/fix issue #5944

Thanks for submitting a PR! Please read these instructions carefully:

[ X ] Explain the motivation for making this change.
[ X ] Provide a test plan demonstrating that the code is solid.
[ x ] Match the code formatting of the rest of the codebase.
[ x ] Target the master branch, NOT a "stable" branch.

Motivation (required)
#5944 has been the number one crash on Bugsnag for several of our production apps.
In Development, this crash is easily reproducible by just clicking around and others have noted that this is caused by a bug in the underlying event system in Android. Considering we do not control the version of Android our apps run on, I propose this change to prevent this issue from crashing the app but instead catching any exceptions thrown by the dispatchJSTouchEvent.
If this approach could cause issues I don't foresee now, let me know. I would love to collaborate on the solution that solves it in a better way.
Test Plan (required)
Tested this against several of our apps on 0.42.2+fix.
The issue was no longer causing crashes and I did not notice any other harmful side effects.
Also using the command mentioned in this comment adb shell input swipe 360 948 30 236 89 does not cause crashes anymore, but instead prints a warning unknown:React: Unable to coalesce touch event; Tried to increment non-existent cookie.

Hi, I noticed that #5944 seemed to have been moved away. travis is failing on master so I the reference from the issue is removed. Could you have a look at this PR? @dmmiller @grabbou

I missed the fix in 0.44 release; https://github.com/facebook/react-native/commit/d2939eafbf56f99ea4da7374b9812ae6f54c1d3d
closing.


text:
Use boost-for-react-native CocoaPod

Motivation
Use the same header-only distribution of Boost that Android and the automatic ios-install-third-party.sh script uses. Greatly speeds up pod install, even when the distribution was already cached.
The dependency tree looks like this:

React

cxxreact subspec

Boost (versioned, 1.63.0)
Folly

Boost (any version, will resolve to 1.63.0 from above)

Alternative implementation of PR https://github.com/facebook/react-native/pull/16756. Fixes issue #16381.
Test Plan
(same as https://github.com/facebook/react-native/pull/16756)

Install react-native via Cocoapods (or move a helloWorld react-native application over to use Cocoapods for dependency management)
Add CxxBridge instead of BatchedBridge to your Podfile
run pod install
run react-native run-ios

Related PRs
Add boost.podspec speed up download time & reduce size of the package
Release Notes
[IOS] [BUGFIX] [third-party-podspecs] - optimize CocoaPods installation (Boost distribution)

boost-for-react-native/boost/compatibility/cpp_c_headers/cstddef:10:1: error: unknown type name 'namespace'
Semantic Issue
why？？

authors: CFKevinRef xiaoyongchen


text:
fix: do not throw on missing cliPath, use the default value

Summary
The cliPath has always been optional value and in fact, even had its default value hardcoded in the React gradle file.
In this PR, I am just taking use of it and remove throwing an error, which is going to be a really annoying breaking change.
Changelog
[ANDROID] [INTERNAL] - Don't require cliPath
Test Plan
Run Android project, everything works.
Provide custom cliPath, it gets respected

CC: @hramos @vdmtrv @Esemesek @thymikee

Next step would be to replace defaultCliPath with what we have done for React Native CLI already:
https://github.com/react-native-community/cli/blob/master/packages/platform-android/native_modules.gradle#L220-L222
In other words, run console.log(require('react-native/cli').bin); from the Gradle project root, which will point us to the closest node_modules location containing the CLI.
We already use this logic in other parts of Gradle build process, so it's proven to work.

If rootProject.projectDir is defined here as well, then, we can use the same mechanism to learn about the path. This will be better than using hardcoded version, which isn't going to work in most cases.

Shipped a simple function that tries to detect the CLI path by running CLI command. If it fails (it will not work in React Native source because there's no react-native package there), it will try to use the default path (which was present from the very beginning and covers most of the cases). Lastly, it will throw the error that we throw right now, asking to provide the path explicitly.
Just want to point out that in Groovy, if the process fails with non-zero exit code, the text/getText() will be empty.

Wanted to point out that we use the same logic here as in detectEntryPoint https://github.com/facebook/react-native/blob/1b5d53a2fa0101fd9a5db98410fc5ea89354836d/react.gradle#L12.

@vdmtrv would you mind checking if this works for you? Should be a matter of copying-pasting to your node_modules.

I have confirmed this works on a brand new project (limited with 0.63 branch), the cliPath has the following location:

/private/tmp/RNTestProject/node_modules/@react-native-community/cli/build/bin.js
resolved by the node script.

The fallback location is:

/private/tmp/RNTestProject/android/app/../../node_modules/react-native/cli.js

which also works in case node script would fail.


text:
[0.71] Android Pick Requests for 0.71.0-rc3

Summary
This PR contains all the cherry-picks needed to be shipped inside 0.71.0-rc3 for the sake of Android.
The list of commits is:
e108e9ebf1e RNGP - Fix DependencyUtils for Windows support (#35508)
89cac880282 Rename hermes-* target to don't use dashes (#35506)
67b74e7a9b9 RNGP - Various improvements needed for 3rd party libs (#35496)
a7a43f8445e Expose jscruntime to be consumed via Prefab
f283877c21d Move JSCRuntime into its own folder (#35482)
5cffb4fa009 Bump AGP to 7.4.x (#35456)
804d2b5bf1d Allow reactnativejni to be consumed via prefab (#35461)
9628e561258 Add missing headers to react_nativemodule_core prefab module (#35460)
f27947431ba Add prefab for _uimanager _scheduler and _mounting (#35458)
b89efc8473a Expose hermes-executor to be consumed via prefab (#35457)
b1bf8c51d0b Consolidate hermes-executor-debug and -release inside a single target (#35454)
658d7dd52e3 RNGP - Correctly Support Gradle Configuration Cache (#35455)
I haven't bumped RNGP, but that is needed.
The only merge conflict I had was on packages/rn-tester/RNTesterPods.xcodeproj/project.pbxproj but that shouldn't be a problem for the sake of the release.
I would suggest to just do a plain merge of this stack so the git history will just fast forward.
Changelog
[Internal] - Android Pick Requests for 0.71.0-rc3

There are only a couple of changes in the xcodeproj that I don't think they should be there (i.e.: we don't want to show them in the upgrade helper). They came with this commit: https://github.com/facebook/react-native/commit/f283877c21da253e3a2a0a828747489733843f88

the RNGP work to allow for libraries with transient + deps on react-native was a big help to me / react-native-firebase, thank you!

authors: cipolleschi cortinico mikehardy


text:
fix: prevent iOS modal to be presented multiple times

Summary:

Got crash when navigating to other screen while modal is being closed, it throws NSInvalidArgumentException', reason: 'Application tried to present modally a view controller <RCTModalHostViewController: 0x125fb63d0> that is already being presented by <UIViewController: 0x125f152e0>., similar with https://github.com/react-navigation/react-navigation/issues/11201. It seems the RCTModalHostViewController is already presented and the other VC (when navigating to new screen) tried to present it again.
To fix this issue, I added validation before presenting the modal to check if the it's already presented.
The other alternative is to adjust this validation to not present the modal if RCTModalHostView instance is exists in self.superview.reactSubviews.
Changelog:

[IOS] [FIXED] - Prevent iOS modal to be presented multiple times
Test Plan:

Repro can be found here, using react-native 0.72.3
After:
https://github.com/facebook/react-native/assets/5382429/e8f00fbf-9a8d-4550-93b6-9ed80f813ae9

maybe @cipolleschi could help to review? 🙏

Let me know if I understood correctly. The use case is that:

We have a hierarchy A -push-> B -present-> X
X is then dismissed
Then you navigate back from B to A
The app crashes because React Native thinks that A wants to present X but it sees as X is already presented by B.
Is that right?

If that's the case, I don't think this is the right fix. In iOS, when a Modal is dismissed, it should be deallocated.
If that's not the case, it means that either Modal is leaking or your specific modal is using a component that is leaking and it's preventing the Modal to be dismissed.
If we land this change, we may incurr into a problem where Modal X is presented, then dismissed, but then it can't be presented anymore as it has its window assigned.

The app crashes because React Native thinks that A wants to present X but it sees as X is already presented by B.
Is that right?

yeah, this is also my assumption, the issue will be occurred when the Modal is  kinda presented (even though it's in the process to be dismissed) and another VC try to present the Modal somehow.
In the repro, the crash happened when I tried to close the Modal and navigate to itself, it's consistently happened.
In another case, the app will crash intermittently (mostly happens in iOS 16.5+) when doing following steps:

We are in Screen A
Open Modal X in Screen A
Close Modal X + Navigate to Screen B

Already tried to add setTimeout to "wait" for the modal completely dismissed but it's not guaranteed to help.

If we land this change, we may incurr into a problem where Modal X is presented, then dismissed, but then it can't be presented anymore as it has its window assigned.

I think the window will be unassigned once the Modal dismissed, no? I tried to show/hide the Modal multiple times and still working.
Or do you have any other suggestion regarding this?

I think the window will be unassigned once the Modal dismissed, no?
In theory, when the Modal is dismissed, it should be destroyed. So, not only windows should be unassigned, but the object should not exists at all.. :/
That's why I'm very confused and I fear that this fix could not be the root cause fix.

@sammy-SC am I missing something?

I think the window will be unassigned once the Modal dismissed, no?
In theory, when the Modal is dismissed, it should be destroyed. So, not only windows should be unassigned, but the object should not exists at all.. :/
That's why I'm very confused and I fear that this fix could not be the root cause fix.

@sammy-SC am I missing something?

Just checked that there's racing condition when navigating after closing the modal that makes the modal not deallocated yet. Adding setTimeout will make deallocated to be called before navigating, but again, it's not guaranteed to safely "wait" the modal to be completely dismissed.

Hi @adrianha, I was looking into the issue, and actually I don't think this is the right fix.
We already have _isPresented and _isVisible checks that should do what you are trying to achieve.
We are more inclined to think that the problem is in the app code.
Specifically, in the repro, there is:
 <Modal animationType="slide" transparent={true} visible={modalVisible}>
        <View style={styles.centeredView}>
          <View style={styles.modalView}>
            <Text style={styles.modalText}>Hello World!</Text>
            <Pressable
              style={[styles.button, styles.buttonClose]}
              onPress={() => {
                setModalVisible(false);
                navigation.dispatch(StackActions.replace('Home'));
              }}>
              <Text style={styles.textStyle}>Hide Modal</Text>
            </Pressable>
          </View>
        </View>
      </Modal>

where, onPress you are doing both setting the modal as not visible and navigating away.
However, the right way to dismiss and navigate for iOS is to use the Modal's onDismiss callback.
By doing everything in the onPress function, there is no time for the system to dismiss the modal and set is state as notPresented.
Does this make sense?
onDismiss is an iOS only callback. I'm not sure how it should work on Android, but, worst case scenario, you can do something like:
 <Modal animationType="slide" transparent={true} visible={modalVisible} onDismiss={() => navigation.dispatch(StackActions.replace('Home')}>
        <View style={styles.centeredView}>
          <View style={styles.modalView}>
            <Text style={styles.modalText}>Hello World!</Text>
            <Pressable
              style={[styles.button, styles.buttonClose]}
              onPress={() => {
                setModalVisible(false);
                if (Platform.OS !== 'ios') {
                 	navigation.dispatch(StackActions.replace('Home'));
			   }
              }}>
              <Text style={styles.textStyle}>Hide Modal</Text>
            </Pressable>
          </View>
        </View>
      </Modal>

By doing everything in the onPress function, there is no time for the system to dismiss the modal and set is state as notPresented.
Does this make sense?
onDismiss is an iOS only callback. I'm not sure how it should work on Android, but, worst case scenario, you can do something like:

hey @cipolleschi, thank you for investigating! Agreed that in some cases it can be done as per what you've suggested, wait for the modal completely dismissed using onDismiss props, even though it's not quite straightforward and the API is only available in iOS.

We already have _isPresented and _isVisible checks that should do what you are trying to achieve.

I was thinking that this diff is similar with self.window that guards the "real" condition of the Modal, even though we already have _isPresented and _isVisible.
I'm also intrigued with this validation that tells to do nothing when RCTModalHostView instance is not available in the reactSubviews. If the validation replaced with this (do nothing when RCTModalHostView is exists on the reactSubviews, this can also fix the issue:
if ([self.superview.reactSubviews containsObject:self]) {
  return;
}

Any thoughts on this?

Agreed that in some cases it can be done as per what you've suggested, wait for the modal completely dismissed using onDismiss props, even though it's not quite straightforward and the API is only available in iOS.

Yeah, the fact that the APIs is iOS only it is not great, I agree. But I think that that's the right way to use it.
Probably, we should make that onDismiss working also on Android... perhaps the calling the onDismiss callback when the modal visibility is set to false on that platform will work.. What do you think?

I'm also intrigued with this validation that tells to do nothing when RCTModalHostView instance is not available in the reactSubviews. If the validation replaced with this (do nothing when RCTModalHostView is exists on the reactSubviews, this can also fix the issue:

That validation can actually works... but it is kind of expensive as the containsSubview will have to go through all the subviews contained by the parent view... so the more views there and in the screen, the longer it will take.

Yeah, the fact that the APIs is iOS only it is not great, I agree. But I think that that's the right way to use it.
Probably, we should make that onDismiss working also on Android... perhaps the calling the onDismiss callback when the modal visibility is set to false on that platform will work.. What do you think?

Yes, that will help to make the implementation for handling modal consistent on both platform.

That validation can actually works... but it is kind of expensive as the containsSubview will have to go through all the subviews contained by the parent view... so the more views there and in the screen, the longer it will take.

Understood that containsSubview might be expensive to iterate the subviews. What if we move the new validation to didMoveToWindow? I observed that if RCTModalHostView instance is exists in the subviews then _modalViewController.view.window is also available 🤔.
- (void)didMoveToWindow
{
  [super didMoveToWindow];

  if (_modalViewController.view.window) {
    return
  }

  ...
}

related with https://github.com/facebook/react-native/blob/03053b6e3e5f86d215917a3a7523bc1e3bc8859b/packages/react-native/React/Views/RCTModalHostView.m#L129-L133, I'm wondering what is the use case of this validation? Tried to add breakpoint there but never called 😅

authors: adrianha cipolleschi


text:
fix: TypeError: glob.sync is not a function

https://github.com/isaacs/node-glob/issues/493
Fixes #44712
Changelog
Internal Fixed - TypeError: glob.sync is not a function #44713

Let me know if this needs to be done in all places, I can see 4 other occurrences in scripts/

It seems like the real bug here is that we are resolving from react-native package, which does not explicitly depend on glob. That means a random version is pulled in.
@regalstreak does this issue go away if we update packages/react-native/package.json to consistent glob version as used elsewhere in repo?
https://github.com/search?q=repo%3Afacebook%2Freact-native+glob+language%3Ajson&type=code

@NickGerleman it does indeed, glob@^7.1.1 works.
Our app uses glob@^9.2.1, guessing the apps version is being picked

@NickGerleman done!

authors: NickGerleman regalstreak


text:
Fix junk in React warnings in Logbox

Before all React errors showed junk like this:

This is because isComponentStack detected a component stack but parseComponentStack couldn't actually parse it (it doesn't deal with React's current format like in Foo (created by FeedItemInner)) so componentStack was an empty array, resulting in the next block of code pushing stuff into argsWithoutComponentStack again, thus repeating its args.
The fix is not to do that. Result on my local copy:

Ofc this doesn't actually show the component stack but that was broken before too.
I edited in-place in my node_modules so I haven't verified this 100% works on main.
Hope this is useful!
Changelog:
[General] [Fixed] - Remove accidental duplication in React warnings in Logbox

Actually maybe this already got fixed on main due to https://github.com/facebook/react-native/pull/43166 because now source-less stacks get properly parsed? Still, I think this fix is worth getting in because pushing in the same array in two rounds that can potentially overlap doesn't make sense. This would prevent it breaking again next time the format changes.

Thanks @gaearon! Is this something we can cover with a [unit test](https://github.com/facebook/react-native/blob/a569c82eb5bba755cd5e7cc7e53e023af0edcf3b/packages/react-native/Libraries/LogBox/Data/tests/parseLogBoxLog-test.js?

@gaearon thanks, I added a test but you're right that this was already fixed on main. I requested a pick to 0.74 but I don't think it made it in.

authors: gaearon motiz88 rickhanlonii


text:
Adds feature flag for onLayout event coalescing

Summary:
In the old architecture, Android coalesced onLayout events, ensuring that when the JS thread was busy, intermediate onLayout results were ignored.
This adds a feature flag to experiment with a similar coalescing behavior for the new architecture.
Differential Revision: D62297082

Closed internally

authors: javache rozele


text:
Change the signature of onDropViewInstance. issue #5053

https://github.com/facebook/react-native/issues/5053

Thanks for the PR! However, now that I think about it, it doesn't make a lot of sense to pass the context at all, since we're passing the view and that will always have a reference to it. Can you remove the context parameter completely?

@foghina You're right. I'm a newbie at  the android programming so I didn't noticed that.

Thanks, this looks good!
@facebook-github-bot shipit

authors: deminoth foghina


text:
[Image] Make source prop required on iOS

Makes source required across both platforms.

We actually removed the isRequired check on iOS because it was common enough to send null as images and adding the if everywhere was a lot of boilerplate and didn't provide much value.
This is a tradeoff between usability and purity.
Since it looks like they are not in sync, do you mind removing the isRequired check on android instead?

:+1: Sure. Wasn't sure which one to change.

@facebook-github-bot shipit

authors: christopherdro vjeux


text:
Spacings seem to have typos?

https://github.com/facebook/stylex/blob/9b3db10a6f4c5cdb315a90974db1a7f91c842bd6/packages/open-props/src/sizes.stylex.js#L117
Based on https://github.com/argyleink/open-props/blob/main/src/props.sizes.css
These should probably be
xxs: "240px",
xs: "360px",
...

Good catch! I don't know how this slipped through.

authors: cly nmn

repo: facebook/stylex


text:
added reboot_test files

Summary
Added unit tests for reboot.go

FIxes #286

@khareyash05 Did you run the tests?

Closing since there is no movement. Feel free to resubmit.

authors: iqHpi khareyash05 leoleovich

repo: facebook/time


text:
Grps instead of the spent

As far as TV is concerned, I only have the overall investment, but I also have the detail per channel, format, seconding etc (I do not have the investment in this detail though). My intention was firstly to run a model considering the total investments per TV. As a second step, I would like to find a way to get the curves for the GRPs on the 4 details for which I do not have the investments, so instead of considering the investments consider the grps. Is there a way to fix the parameters of the first model? My goal is to reweight the overall TV investment for the 4 levels of GRPs for which I don't have the investment detail, while still considering the effect of all other variables. Do you have any advice?

This is the same issue as. https://github.com/facebookexperimental/Robyn/issues/733, so closing this one

authors: AlessioPallotti gufengzhou

repo: facebookexperimental/Robyn


text:
A Couple Bugs With "Undo"

Description
(1) Using "Undo" after creating data using the Map Tool doesn't undo an edit on the first go. It doesn't start undo the edit until the second attempt.

The first attempt to "Undo" seems to be undoing the auto-zoom.
If multiple geometries (lines for example) are drawn before "Undo", the first attempt still only adjust zoom without undoing an edit then continuing to undo there will be an auto-zoom plus undoing an edit with every separate feature.

(2) Undoing a line segment leaves a residual node. It only removes one node, instead of both nodes to completely remove the line. The normal ID editor removes both nodes of a 2 node line.
Version
2.0-alpha
What browser are you seeing the problem on? What version are you running?
Opera GX [LVL4 {core: 89.0.4447.98) (x86_64)}
Steps to reproduce
(1) Use the Line Tool to draw a line segment - Undo using the button at the top right or cmd+Z - No edits are undone.

Draw 3 separate line segments consecutively - After the third line begin to Undo until there are no more edits - Notice the auto-zoom when beginning to undo a new segment.

(2) Use the Line Tool to draw a line segment - Undo (twice if the above issue still exists) - Only one of the nodes is removed.
The browser URL at the time you encountered the bug
https://mapwith.ai/rapid-v2-alpha#background=Bing&datasets=fbRoads,msBuildings&map=20.79/34.00637/-117.92466

More about this issue: we were getting our 'annotations' mixed up in the history, which was causing too many undos to be required in order to back changes out.

Fixed in b662854: Fix #258 by cleaning up the state transitions in the history that resulted from a line draw operation.

authors: Bonkles flow-enol

repo: facebookincubator/RapiD

license: ISC


text:
Custom font produce dragging behavior (FOUT, FOIT)

Is this a bug report?
Yes

Environment

node -v: v6.10.3
npm -v: 3.10.10
yarn --version (if you use Yarn): 0.27.5
npm ls react-scripts (if you haven’t ejected): 1.0.11

Then, specify:

Operating system: OSX 10.12.6
Browser and version:

Chrome Version 60.0.3112.101
Safari Version 10.1.2

Steps to Reproduce

git clone git@github.com:tsmirnov/create-react-app-fout-example.git
yarn start

Try to update page several times. You will see FOUT.
Expected Behavior

I expect page load without dragging (FOUT, FOIT)
Actual Behavior

First page load behave like this:

Reproducible Demo

https://github.com/tsmirnov/create-react-app-fout-example

I added custom font like @gaearon proposed on stackoverflow. However, I get FOUT.
This is happening, because fonts are loaded asyncronusly. Synchronous font loading must solve the problem. I couldn't find anywhere how to do it properly without eject. I can work on PR, to solve that issue. What do you think?

Well this is less than optimal!
We'd like this to not happen, I recall we had an issue open about it once before but I cannot recall the terms to search for it.
IIRC it was a webpack option that needed flipped to include the styles in the main JS bundle instead of loading them async; could you try to dig this up?
I'd be happy to take a PR to fix this, we can discuss the implications of such a change then.
Thanks!

Sure. I've just wanted to verify before PR. I will try to dive deeper and let you know.

21 авг. 2017 г., в 22:17, Joe Haddad notifications@github.com написал(а):
Well this is less than optimal!
We'd like this to not happen, I recall we had an issue open about it once before but I cannot recall the terms to search for it.
IIRC it was a webpack option that needed flipped to include the styles in the main JS bundle instead of loading them async; could you try to dig this up?
I'd be happy to take a PR to fix this, we can discuss the implications of such a change then.
Thanks!
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub, or mute the thread.

So, I've investigated that issue. The reason we get FOIT is that browser loads fonts asyncronusly. User see the page first, browser loads font and then renders the page again.
The most reasonable solution is to use fontfaceobserver and defer rendering before fonts are loaded:
@font-face {
  font-family: 'Myfont';
  font-style: normal;
  font-weight: 400;
  src: url('./Myfont.ttf');
}

import './index.css';
import FontFaceObserver from 'fontfaceobserver';

new FontFaceObserver('Myfont').load().then(() => {
  ReactDOM.render(<App />, document.getElementById('root'));
});

It fixes the FOUT, but until that issue is solved, you will get ESLint warnings in console. I will let you know, when it will be fixed.
PS
I don't think we can fix that inside react-scripts. I think, we should just add this recommendation to documentation on how to use custom fonts. Should I make PR for README.md?

Documentation for this would be appreciated!
See #2415 and #3086 for more discussion.

authors: Timer tsmirnov

repo: facebookincubator/create-react-app


text:
Instruct Jest to load native components from RNW instead of RN

This small change fixes #1085. Basically it includes @gaearon's suggested fix.

Thank you!

Should be in 0.8.3.

authors: gaearon remon-georgy


text:
question on tooling for translators

Hey folks!
I got 2 important questions to consider this in our next project:

Does this somehow support exporting to .mo files and vice versa ?
If not is there any open source tooling that you're using for translators ?

Cheers

Thanks for reaching out to us Hotell!

Currently, we do not support exporting to .mo files but we will look into it and evaluate this option.
We do not directly support any open source tooling at this point either. However, the output and input formats are not super complex, so I would imagine it to not be too hard to make these work with open source tools.

@w1106c, @jrwats I'm getting ready to localize an application that we would like to use FBT for and this question is super relevant. I'm interested in your experience working with vendors to do the actual translations. Were FBT's JSON files designed to be compatible with some of the more popular translation file formats for tools used by translators, or is it a brand new standard? Or do you just give the raw JSON to translators and have them edit the same files inline?

@AndrewCraswell, we actually have an internal tool to which vendors have access and through which they submit translations.  They're shown the source string and description (as seen in the JSON output), and for any given parameter, they have the option to specify different strings depending on the variation of the parameter.  These variations are determined on a per-locale basis.
We don't show them raw JSON

I'll take today to look at how difficult it'd be to produce a POT file from FBT collection and similarly, ingest a PO file(s) for translation.

That would be incredible. I think if something along those lines could become a feature than this library would be a perfect replacement for many existing localization libraries.

Yeah it //appears// pretty straightforward from what I read so far.  I'm
hoping to get away with making POT and PO files in python brace format.
On Wed, Oct 9, 2019, 10:48 AM Andrew Craswell notifications@github.com
wrote:

That would be incredible. I think if something along those lines could
become a feature than this library would be a perfect replacement for many
existing localization libraries.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/facebookincubator/fbt/issues/60?email_source=notifications&email_token=AAN4WFXGIGMZKLOUZBN5PSTQNYKNBA5CNFSM4HKTNLI2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEAYXOFI#issuecomment-540112661,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/AAN4WFSI6ZQYQSNJQKT23ZLQNYKNBANCNFSM4HKTNLIQ
.

authors: AndrewCraswell Hotell jrwats w1106c

repo: facebookincubator/fbt


text:
Use computeChainDataLength() instead of length()

Should use computeChainDataLength() instead of length(), below is comments from folly/io/IOBuf.h
  /**
   * Get the size of the data for this individual IOBuf in the chain.
   *
   * Use computeChainDataLength() for the sum of data length for the full chain.
   *
   * @methodset Buffer Capacity
   */
  std::size_t length() const { return length_; }

@mbasmanova @Yuhta @xiaoxmeng Can you review this PR?

repo: facebookincubator/velox


text:
Fix segfault in HashTable::loadTag()

Fixes https://github.com/prestodb/presto/issues/20032
When the number of unique entries in the HashTable crosses int32 max, the offset param passed to HashTable::loadTags() method gets downcast to int32. This leads to segmentation fault as the offset is corrupted.
Added a repro test which is currently disabled. It takes really long time to complete and will likely get timed out on CircleCI.

@xiaoxmeng would you please help with the merge. The failure with fuzzer is a known issue:
https://github.com/facebookincubator/velox/issues/6474


text:
Inference in half precision

Hey,
just wanted to ask whether it is safe to run DINOv2 in half precision for inference. Is there any degradation in the quality of the features?
Thanks!

Whether or not float16 leads to a degradation probably depends on the use case. For example, if you pass the features into a model that's very heavily fit to the output of the float32 version, maybe it breaks on float16. This seems to (very rarely) happen on some depth estimation models I've tried. Using bfloat16 usually fixes the problem.
Following from issue #373, here's a comparison of the token norms at each block of vit-l running on the same input image, with float32 on the left & float16 on the right. Qualitatively at least, they're identical. Even the 'high norm' tokens are the same, which suggests that the float16 conversion doesn't lead to unstable results.

Thank you very much!

Just as a follow up, to not give the impression that bfloat16 is always better to use, here's a small zoomed/cropped section of a depth estimate of some rocks on the ground. There's a plane-of-best-fit removal and a contrast boost, so it's a bit of an extreme example, just to show the differences. Float32 is on the left, then float16, then bfloat16:

Float32 and 16 look very similar (there are slight differences when flipping between images though). On the otherhand, bfloat16 has visible grid-like artifacts.
From what I've seen, float16 is usually fine, but rarely will give random inf or NaN results, in which case bfloat16 tends to give more reasonable results (but otherwise always has small artifacts).

hi @heyoeyo, I am curious about the inference speed up using float16 or bfloat16 inference, would you care to share your experience with it?

hi @maulanaazhari
Switching from float32 to float16 or bfloat16 consistently gives a 2x speed up on almost any model I've tried (the only exception is very small models). If you're also using xFormers (with dinov2), then that seems to give an additional speed up when using f16.

authors: Tomsen1410 heyoeyo maulanaazhari


text:
AttributeError: MMapIndexedDataset' object has no attribute '_bin_buffer_mmap

What is the problem here, please?
I was trying to run this baseline following  the steps:

download data
set up baselines
 preprocess data using the second command

python3 structured-uncertainty/preprocess.py  --srcdict baseline-models/dict.en.txt --tgtdict baseline-models/dict.ru.txt --source-lang en --target-lang ru \
--trainpref wmt20_en_ru/train --validpref wmt20_en_ru/valid --testpref wmt20_en_ru/test19,wmt20_en_ru/reddit_dev  \
--destdir data-bin/wmt20_en_ru --thresholdtgt 0 --thresholdsrc 0  --workers 24

no need for me to train now, so coming directly to running their baseline  for example single base line I got this error :
python3 structured-uncertainty//generate.py wmt20_en_ru/ --path baseline-models/model1.pt --max-tokens 4096 --remove-bpe --nbest 5 --gen-subset test

Namespace(no_progress_bar=False, log_interval=1000, log_format=None, tensorboard_logdir='', seed=1, cpu=False, fp16=False, memory_efficient_fp16=False, fp16_init_scale=128, fp16_scale_window=None, fp16_scale_tolerance=0.0, min_loss_scale=0.0001, threshold_loss_scale=None, user_dir=None, empty_cache_freq=0, all_gather_list_size=16384, criterion='cross_entropy', tokenizer=None, bpe=None, optimizer='nag', lr_scheduler='fixed', task='translation', num_workers=1, skip_invalid_size_inputs_valid_test=False, max_tokens=4096, max_sentences=None, required_batch_size_multiple=8, dataset_impl=None, gen_subset='test', num_shards=1, shard_id=0, path='baseline-models/model1.pt', remove_bpe='@@ ', quiet=False, model_overrides='{}', results_path=None, beam=5, nbest=5, max_len_a=0, max_len_b=200, min_len=1, match_source_len=False, no_early_stop=False, unnormalized=False, no_beamable_mm=False, lenpen=1, unkpen=0, replace_unk=None, sacrebleu=False, score_reference=False, compute_uncertainty=False, ensemble_sum_prod=False, prefix_size=0, no_repeat_ngram_size=0, sampling=False, sampling_topk=-1, sampling_topp=-1.0, temperature=1.0, diverse_beam_groups=-1, diverse_beam_strength=0.5, print_alignment=False, print_step=False, iter_decode_eos_penalty=0.0, iter_decode_max_iter=10, iter_decode_force_max_iter=False, iter_decode_with_beam=1, iter_decode_with_external_reranker=False, retain_iter_history=False, decoding_format=None, momentum=0.99, weight_decay=0.0, force_anneal=None, lr_shrink=0.1, warmup_updates=0, data='wmt20_en_ru/', source_lang=None, target_lang=None, load_alignments=False, left_pad_source='True', left_pad_target='False', max_source_positions=1024, max_target_positions=1024, upsample_primary=1, truncate_source=False)
Traceback (most recent call last):
File "/cephfs/home/arij/structured-uncertainty//generate.py", line 330, in
cli_main()
File "/cephfs/home/arij/structured-uncertainty//generate.py", line 326, in cli_main
main(args)
File "/cephfs/home/arij/structured-uncertainty//generate.py", line 32, in main
task = tasks.setup_task(args)
File "/cephfs/home/arij/structured-uncertainty/fairseq/tasks/init.py", line 17, in setup_task
return TASK_REGISTRY[args.task].setup_task(args, **kwargs)
File "/cephfs/home/arij/structured-uncertainty/fairseq/tasks/translation.py", line 174, in setup_task
raise Exception('Could not infer language pair, please provide it explicitly')
Exception: Could not infer language pair, please provide it explicitly

after that, I have tried to provide another path for that dataset since processing data resulted in folder data-bin folder which includes wmt20_en_ru folder containing processed dataset.
python3 structured-uncertainty//generate.py /home/arij/data-bin/wmt20_en_ru/ --path baseline-models/model1.pt --max-tokens 4096 --remove-bpe --nbest 5 --gen-subset test
and I got this error

Namespace(no_progress_bar=False, log_interval=1000, log_format=None, tensorboard_logdir='', seed=1, cpu=False, fp16=False, memory_efficient_fp16=False, fp16_init_scale=128, fp16_scale_window=None, fp16_scale_tolerance=0.0, min_loss_scale=0.0001, threshold_loss_scale=None, user_dir=None, empty_cache_freq=0, all_gather_list_size=16384, criterion='cross_entropy', tokenizer=None, bpe=None, optimizer='nag', lr_scheduler='fixed', task='translation', num_workers=1, skip_invalid_size_inputs_valid_test=False, max_tokens=4096, max_sentences=None, required_batch_size_multiple=8, dataset_impl=None, gen_subset='test', num_shards=1, shard_id=0, path='baseline-models/model1.pt', remove_bpe='@@ ', quiet=False, model_overrides='{}', results_path=None, beam=5, nbest=5, max_len_a=0, max_len_b=200, min_len=1, match_source_len=False, no_early_stop=False, unnormalized=False, no_beamable_mm=False, lenpen=1, unkpen=0, replace_unk=None, sacrebleu=False, score_reference=False, compute_uncertainty=False, ensemble_sum_prod=False, prefix_size=0, no_repeat_ngram_size=0, sampling=False, sampling_topk=-1, sampling_topp=-1.0, temperature=1.0, diverse_beam_groups=-1, diverse_beam_strength=0.5, print_alignment=False, print_step=False, iter_decode_eos_penalty=0.0, iter_decode_max_iter=10, iter_decode_force_max_iter=False, iter_decode_with_beam=1, iter_decode_with_external_reranker=False, retain_iter_history=False, decoding_format=None, momentum=0.99, weight_decay=0.0, force_anneal=None, lr_shrink=0.1, warmup_updates=0, data='/home/arij/data-bin/wmt20_en_ru/', source_lang=None, target_lang=None, load_alignments=False, left_pad_source='True', left_pad_target='False', max_source_positions=1024, max_target_positions=1024, upsample_primary=1, truncate_source=False)
| [en] dictionary: 43768 types
| [ru] dictionary: 48272 types
Traceback (most recent call last):
File "/cephfs/home/arij/structured-uncertainty//generate.py", line 330, in
cli_main()
File "/cephfs/home/arij/structured-uncertainty//generate.py", line 326, in cli_main
main(args)
File "/cephfs/home/arij/structured-uncertainty//generate.py", line 33, in main
task.load_dataset(args.gen_subset)
File "/cephfs/home/arij/structured-uncertainty/fairseq/tasks/translation.py", line 200, in load_dataset
self.datasets[split] = load_langpair_dataset(
File "/cephfs/home/arij/structured-uncertainty/fairseq/tasks/translation.py", line 54, in load_langpair_dataset
src_dataset = data_utils.load_indexed_dataset(prefix + src, src_dict, dataset_impl)
File "/cephfs/home/arij/structured-uncertainty/fairseq/data/data_utils.py", line 73, in load_indexed_dataset
dataset = indexed_dataset.make_dataset(
File "/cephfs/home/arij/structured-uncertainty/fairseq/data/indexed_dataset.py", line 60, in make_dataset
return MMapIndexedDataset(path)
File "/cephfs/home/arij/structured-uncertainty/fairseq/data/indexed_dataset.py", line 448, in init
self._do_init(path)
File "/cephfs/home/arij/structured-uncertainty/fairseq/data/indexed_dataset.py", line 461, in _do_init
self._bin_buffer_mmap = np.memmap(data_file_path(self._path), mode='r', order='C')
File "/home/arij/anaconda3/envs/work/lib/python3.9/site-packages/numpy/core/memmap.py", line 264, in new
mm = mmap.mmap(fid.fileno(), bytes, access=acc, offset=start)
ValueError: cannot mmap an empty file
Exception ignored in: <function MMapIndexedDataset.del at 0x7f1c5e2aff70>
Traceback (most recent call last):
File "/cephfs/home/arij/structured-uncertainty/fairseq/data/indexed_dataset.py", line 465, in del
self._bin_buffer_mmap._mmap.close()
AttributeError: 'MMapIndexedDataset' object has no attribute '_bin_buffer_mmap'

I have tried to ask the authors but according to them, this problem is not from their side. Need help to understand what is going on please, Thanks!
environment

fairseq Version 0.10.0:
PyTorch Version  1.9.0
OS ubuntu 20.04:
How you installed fairseq pip:
Build command you used (if compiling from source):
Python 3.9.5:
CUDA  11.0:
GPU A100-SXM4-40GB:

any updates on this?

did you fix it? @nikhiljaiswal

any one know how to fix?

I find that i did not install apex completely
I have solved by reinstall cuda toolkit and pytorch (check the same version)

i'v tried several times and found that this configuration works for me: python=3.8  pytorch==1.10.0 cuda=11.1 fairseq==0.10.0 gpu=3090

authors: Arij-Aladel MiuGod0126 nikhiljaiswal robotsp tjshu

repo: facebookresearch/fairseq


text:
Robot wrapper fixes

Motivation and Context
Changes necessary to get critical Habitat Lab changes working. To do so, I needed a third person camera for visualization, helper utilities for base properties, and ignorable link collision names.
How Has This Been Tested
Running tests/test_robot_wrapper.py
Types of changes

[ ] Docs change / refactoring / dependency upgrade
[ ] Bug fix (non-breaking change which fixes an issue)
[x] New feature (non-breaking change which adds functionality)
[x] Breaking change (fix or feature that would cause existing functionality to change)

Changes:

Utilities for the base.
Added third person camera (we may want to think of a more general API for getting and setting cameras in case we want to add more cameras to a robot).
Refactored the interpolate arm function.

Checklist

[x] My code follows the code style of this project.
[ ] My change requires a change to the documentation.
[x] I have updated the documentation accordingly.
[x] I have read the CONTRIBUTING document.
[x] I have completed my CLA (see CONTRIBUTING)
[x] I have added tests to cover my changes.
[x] All new and existing tests passed.

@ASzot Please properly lint the files as well.

Please, use black, flake8 and others tools we have wired using pre-commit:
pip install pre-commit && pre-commit install.

authors: ASzot Skylion007 mathfac

repo: facebookresearch/habitat-sim


text:
removing unnecessary mkdirs

Following: https://github.com/facebookresearch/habitat-sim/pull/630

It indeed passes CI tests!


text:
Will maskrcnn-benchmark support pytorch1.1 in the future?

❓ Questions and Help

maskrcnn-benchmark can use pytorch-1.1 right now.

maskrcnn-benchmark can use pytorch-1.1 right now.

OK，thank you

repo: facebookresearch/maskrcnn-benchmark


text:
Productivity modules in miners?

Describe the bug

To Reproduce
https://factoriolab.github.io/list?s=***2&v=10

Expected behavior

This isn't a bug, this is how that preset has always worked. There's actually no way with the current code to set it up so that a specific preset includes different configurations for different machines.

I would recommend just setting it up however you want, and then saving that as a saved state instead. That way you can customize it to your heart's desire.

repo: factoriolab/factoriolab


text:
WIP: Add proper volumes support

This PR uses and reorganize how volumes and how batch-scheduler stores things.

DATA_DIR env is used to specify root data dir used by batch-scheduler

Structure is :
/tmp/batch-scheduler
├── store
│   └── batch.store
├── validator
└── wd
    ├── 4a50336d-f979-4d55-9059-7436c34af4ad
    │   └── docker-compose.yml
    ├── 9b50bd9d-5c12-48fd-8038-030bce426fdb
    │   └── docker-compose.yml
    ├── adb9b01d-b9bd-474f-9e49-7995ee1d6af8
    │   └── docker-compose.yml
    ├── bb1935bd-eda0-49e6-823a-4f499fc1d986
    │   └── docker-compose.yml
    ├── c8c9a448-c5b9-4427-a2a3-2dbaacac22d8
    │   └── docker-compose.yml
    └── f90665c6-fdb8-48bd-8a89-50bd73e77abe
        └── docker-compose.yml

where store is for the bbolt db, validator is used as a tmp directory to verify compose file and wd is working directory.
In wd each task as it's own space with :

docker-compose.yml

.env

volumes dir that contains the volumes task storage

[X] Reorganize storage

[X] Volumes validation and constraints check

[x] Lazy volumes tree creation on task UP.

LGTM

The PR name starts with WIP:, why?

The PR name starts with WIP:, why?

Shity handling of WIP PR by Github.

authors: athoune papey

repo: factorysh/batch-scheduler


text:
🛑 ecologia.misiones.gob.ar is down

In 0e2fef3, ecologia.misiones.gob.ar (https://ecologia.misiones.gob.ar/) was down:

HTTP code: 0
Response time: 0 ms

Resolved: ecologia.misiones.gob.ar is back up in 9100635.


text:
Function privacy returns "[Array]"

Description:
Store.privacy function is not returning words/phrases like "Email Address", "Phone Number" as shown in the provided example in Readme, now it returns "[Array]" under "dataCategories" and "purposes" sections (see example below).
Example code:
var store = require('app-store-scraper');

store.privacy({
  id: 324684580,
})
.then(console.log)
.catch(console.log);

Error message:
{
  managePrivacyChoicesUrl: null,
  privacyTypes: [
    {
      privacyType: 'Data Used to Track You',
      identifier: 'DATA_USED_TO_TRACK_YOU',
      description: 'The following data may be used to track you across apps and websites owned by other companies:',
      dataCategories: [Array],
      purposes: []
    },
    {
      privacyType: 'Data Linked to You',
      identifier: 'DATA_LINKED_TO_YOU',
      description: 'The following data, which may be collected and linked to your identity, may be used for the following purposes:',
      dataCategories: [],
      purposes: [Array]
    }
  ]
}

Looks to me like this is just because of the console.log function? Try calling JSON.stringify first.

Has anyone improved the code to return the Arrays content i.e. "Email Address", "Phone Number" rather than the work [Array]?

authors: edubasegr kasnder xxccm

repo: facundoolano/app-store-scraper


text:
Dummy Memory map removed and replaced memory map based on KM_HAL in KM_app.h

Notes:

Pull requests will not be accepted until the submitter has agreed to the contributer agreement.
This is just a template, so feel free to use/remove the unnecessary things

Description
A few sentences describing the overall goals of the pull request's commits.
Status
READY/IN DEVELOPMENT/HOLD
Migrations
If this PR changes any APIs or behaviors, give a short description of what API users should do when this PR is merged.
YES | NO
Related PRs
List related PRs against other branches:

branch
PR

other_pr_production
link

other_pr_master
link

Todos

[ ] Tests
[ ] Documentation

Deploy notes
Notes regarding the deployment of this PR. These should note any
required changes in the build environment, tools, compilers, etc.
Steps to test or reproduce
Outline the steps to test or reproduce the PR here.

@RobMeades please review changes in KM_app.h, file updated to latest revision and formatted with 4 spaces in memory map.

repo: fahim-ublox/mbed-os


text:
Missing circuibreaker package in release v0.6.2

For some reason in version v0.6.1 I can import circuitbreakerbuilder, but in version 0.6.2 it is not available.

I'm not sure what might cause that. I just tried adding 0.6.2 to a new project and CircuitBreakerBuilder was available as expected.

authors: gmirandadev jhalterman

repo: failsafe-go/failsafe-go