text:
Spacy-llm bedrock issue

I am getting the below error
[2023-11-16 17:39:57,111] ERROR in app: Exception on /watsonnlu [POST]
Traceback (most recent call last):
  File "/Users/Naveen/04102023/assistant_nlu_service_proprietary/nav-spacy-test/lib/python3.9/site-packages/flask/app.py", line 2077, in wsgi_app
    response = self.full_dispatch_request()
  File "/Users/Naveen/04102023/assistant_nlu_service_proprietary/nav-spacy-test/lib/python3.9/site-packages/flask/app.py", line 1525, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/Users/Naveen/04102023/assistant_nlu_service_proprietary/nav-spacy-test/lib/python3.9/site-packages/flask/app.py", line 1523, in full_dispatch_request
    rv = self.dispatch_request()
  File "/Users/Naveen/04102023/assistant_nlu_service_proprietary/nav-spacy-test/lib/python3.9/site-packages/flask/app.py", line 1509, in dispatch_request
    return self.ensure_sync(self.view_functions[rule.endpoint])(**req.view_args)
  File "/Users/Naveen/04102023/assistant_nlu_service_proprietary/nlu_service.py", line 62, in message
    resp = predict(data["input"], data["bot_id"])
  File "/Users/Naveen/04102023/assistant_nlu_service_proprietary/nlu/assistant_nlu.py", line 250, in predict
    intent_result=predict_intent(bot_id,user_query,sql_connection,language,session,Is_FAQ_present)
  File "/Users/Naveen/04102023/assistant_nlu_service_proprietary/nlu/predict_intent.py", line 498, in predict_intent
    spacy_llm_output_list=predict_spacy_llm(user_query,file_name)
  File "/Users/Naveen/04102023/assistant_nlu_service_proprietary/nlu/predict_intent.py", line 349, in predict_spacy_llm
    Spacy_LLM_model = assemble(config_file_path)
  File "/Users/Naveen/04102023/assistant_nlu_service_proprietary/nav-spacy-test/lib/python3.9/site-packages/spacy_llm/util.py", line 48, in assemble
    return assemble_from_config(config)
  File "/Users/Naveen/04102023/assistant_nlu_service_proprietary/nav-spacy-test/lib/python3.9/site-packages/spacy_llm/util.py", line 28, in assemble_from_config
    nlp = load_model_from_config(config, auto_fill=True)
  File "/Users/Naveen/04102023/assistant_nlu_service_proprietary/nav-spacy-test/lib/python3.9/site-packages/spacy/util.py", line 587, in load_model_from_config
    nlp = lang_cls.from_config(
  File "/Users/Naveen/04102023/assistant_nlu_service_proprietary/nav-spacy-test/lib/python3.9/site-packages/spacy/language.py", line 1847, in from_config
    nlp.add_pipe(
  File "/Users/Naveen/04102023/assistant_nlu_service_proprietary/nav-spacy-test/lib/python3.9/site-packages/spacy/language.py", line 814, in add_pipe
    pipe_component = self.create_pipe(
  File "/Users/Naveen/04102023/assistant_nlu_service_proprietary/nav-spacy-test/lib/python3.9/site-packages/spacy/language.py", line 702, in create_pipe
    resolved = registry.resolve(cfg, validate=validate)
  File "/Users/Naveen/04102023/assistant_nlu_service_proprietary/nav-spacy-test/lib/python3.9/site-packages/confection/__init__.py", line 756, in resolve
    resolved, _ = cls._make(
  File "/Users/Naveen/04102023/assistant_nlu_service_proprietary/nav-spacy-test/lib/python3.9/site-packages/confection/__init__.py", line 805, in _make
    filled, _, resolved = cls._fill(
  File "/Users/Naveen/04102023/assistant_nlu_service_proprietary/nav-spacy-test/lib/python3.9/site-packages/confection/__init__.py", line 860, in _fill
    filled[key], validation[v_key], final[key] = cls._fill(
  File "/Users/Naveen/04102023/assistant_nlu_service_proprietary/nav-spacy-test/lib/python3.9/site-packages/confection/__init__.py", line 877, in _fill
    getter_result = getter(*args, **kwargs)
  File "/Users/Naveen/04102023/assistant_nlu_service_proprietary/nav-spacy-test/lib/python3.9/site-packages/spacy_llm/models/langchain/model.py", line 90, in langchain_model
    return LangChain(
  File "/Users/Naveen/04102023/assistant_nlu_service_proprietary/nav-spacy-test/lib/python3.9/site-packages/spacy_llm/models/langchain/model.py", line 34, in __init__
    self._langchain_model = LangChain.get_type_to_cls_dict()[api](
  File "/Users/Naveen/04102023/assistant_nlu_service_proprietary/nav-spacy-test/lib/python3.9/site-packages/langchain/load/serializable.py", line 97, in __init__
    super().__init__(**kwargs)
  File "/Users/Naveen/04102023/assistant_nlu_service_proprietary/nav-spacy-test/lib/python3.9/site-packages/pydantic/v1/main.py", line 341, in __init__
    raise validation_error
pydantic.v1.error_wrappers.ValidationError: 1 validation error for Bedrock
model_name
  extra fields not permitted (type=value_error.extra)

where my config file is as follows,
[nlp]
lang = "en"
pipeline = ["llm"]
batch_size = 128

[components]

[components.llm]
factory = "llm"

[components.llm.model]
@llm_models = "langchain.Bedrock.v1"
name = "amazon.titan-text-express-v1"
config = {"model_id": "amazon.titan-text-express-v1"}

[components.llm.task]
@llm_tasks = "spacy.TextCat.v2"
labels = What_can_you_do, Unlock_Account, More_questions
exclusive_classes = false

[components.llm.task.examples]
@misc = "spacy.FewShotReader.v1"
path = "models/nav_testing_3fed4208-dad-4635-8419-b4kumar002_selective_examples.jsonl"

[components.llm.task.normalizer]
@misc = "spacy.LowercaseNormalizer.v1"

Hi @NaveenKumarStark, please always format your code and console output. Thanks for bringing this up, langchain seems to expect different keyword args for Bedrock than for other models. We'll patch this up shortly.

authors: NaveenKumarStark rmitsch

repo: explosion/spacy-llm


text:
[eas-cli] bump oclif help plugin

Checklist

[X] I've added an entry to CHANGELOG.md if necessary. You can comment this pull request with /changelog-entry [breaking-change|new-feature|bug-fix|chore] [message] and CHANGELOG.md will be updated automatically.

Why
Refs ENG-6204
How
This PR bumps our fork of the oclif help plugin, which includes corrected description for the help command in the help prompt
Test Plan
The change has been tested locally by running yarn eas.
Preview

/changelog-entry bug-fix Fix description of help command in help prompt.

source: gharchive/pull-request

repo: expo/eas-cli

license: MIT

license_type: permissive

license_source: github-api


text:
[eas-cli] validate chosen build in eas build:run command

Checklist

[ ] I've added an entry to CHANGELOG.md if necessary. You can comment this pull request with /changelog-entry [breaking-change|new-feature|bug-fix|chore] [message] and CHANGELOG.md will be updated automatically.

Why
When adding a paginated select prompt to the eas build:run I introduced a new bug.

When you have no emulator/simulator builds in your project you will get this strange assertion error message.
EDIT: I noticed that I wasn't sanitizing builds selected by id or as latest. This is also fixed now.
Now I sanitize every selected build to make sure it is valid in the context of the eas build:run command.
How
Throw a custom error if there are no simulator/emulator builds for a given platform.

Test Plan
Manual tests.

/changelog-entry bug-fix Validate chosen build in the eas build:run command


text:
[question] Is this project being maintained?

Hi! I'm currently working on a new Expo project and would like to be able to deploy to desktop via Electron at some point.
I've found this project, but it looks like there's not been anyone maintaining it since its creation (15 months ago).
Are there any plans by Expo to improve support for Electron in the future?

We are moving towards a unified bundling process with Metro, but likewise, we also want to use a unified native runtime as well. Mac Catalyst enables React iOS to run natively on macOS machines, and React Native Windows supports the same on windows. We don't have the bandwidth to support any more platforms outside of iOS, Android, and web right now but if we did, it would be proper native.
This package is a light wrapper around electron-webpack if anyone wants to go more upstream.

Fair enough! I do agree it would be awesome to support desktop native platforms. However, I feel like the problem with that (and I noticed the same in frameworks like Flutter) is that most native packages you'll use in your app won't support desktop platforms, so even if Expo and RN supported those fully, it could still be a problem.
I see Electron as a "quick" win in wrapping the web app into a desktop app, and packages for Node are much easier to find.
So, at least for our first release, we'd like to try and get a quick win here by using electron to build the desktop version of our apps, and later on maybe consider switching to native.

source: gharchive/issue

authors: EvanBacon matallui

repo: expo/expo-electron-adapter


text:
ThemeProvider is not working for external packages.

Summary
I created a component library on top of styled-components.
Library: https://github.com/sangameshsomawar/test
Npm: https://www.npmjs.com/package/@sangameshsomawar/test
When I install the library in any new react-native project or expo project, the theme is getting passed correctly to the external package, and colors are properly rendered.  But when I test the same code in snack, the theme is not working. This issue is only happening in the snack.
Please find below snack examples:

Output when Typography Component is written directly in snack
Output when Typography code is fetched from the library and then referred in snack

Snack Link:https://snack.expo.dev/@sangamesh.somawar/typography
Snack Link: https://snack.expo.dev/@sangamesh.somawar/typography2

I think context is not getting passed correctly in the snack.
What platform(s) does this occur on?
Android, iOS, Web
SDK Version
No response
Reproducible demo or steps to reproduce from a blank project
see above

@IjzerenHein Please Help.

Hi @sangameshsomawar, your library is a full bare react native app. It contains another react native instance which is causing issues here. If you want to add this lib to your project in Snack, you have to create a package with just the JS files you want, not the whole app. (e.g. only the files in lib)
Hope this helps.

@byCedric: I have tried that as well. Let me create a snack example with that approach. I will share it with you here.

authors: byCedric sangameshsomawar

repo: expo/snack


text:
refactor: upgrade to Expo SDK 52

Why
This is a maintenance release, to upgrade to SDK 52. Note, this PR does not turn SDK 52 into the default SDK yet. We still need more testing for that.

[!IMPORTANT]
This PR should be merged after upgrading to the first stable SDK 52 version.

How
See commits, followed the upgrade guide.
Test Plan
See staging.

Going to merge this, and open a PR to upgrade the snack-runtime package separately.


text:
add images as base64 encoded data

make the navigator more resilient to network outages

Thanks!

authors: despairblue ide

repo: exponentjs/ex-navigator

license: mit

license_source: bigquery


text:
chrome lighthouse text compression

i have searched the closed issues and found some others that have the same problem. but no solution
i enabled compression with
app.use(compression({ threshold: 0 }));

chrome networktab says: no compression, no content-encoding.

HTTP/1.1 200 OK
X-Powered-By: Express
Accept-Ranges: bytes
Cache-Control: public, max-age=0
Last-Modified: Sun, 10 Jun 2018 00:30:44 GMT
ETag: W/"1a526-163e71a33c0"
Content-Type: text/css; charset=UTF-8
Vary: Accept-Encoding
Date: Sun, 10 Jun 2018 01:14:59 GMT
Connection: keep-alive
Transfer-Encoding: chunked

chrome lighthouse extension says: Enable Text Compression!

firefox networktab: no content-encoding on the response

i turned debugging on set DEBUG=compression
i see on every request:

compression gzip compression +1m
GET /dist/bundles/medicalpad/index.css 200 1.590 ms - -

if i used curl -i --compressed http://localhost:3000/dist/bundles/medicalpad/index.css
i see

TP/1.1 200 OK
X-Powered-By: Express
Accept-Ranges: bytes
Cache-Control: public, max-age=0
Last-Modified: Sun, 10 Jun 2018 00:30:44 GMT
ETag: W/"1a526-163e71a33c0"
Content-Type: text/css; charset=UTF-8
Vary: Accept-Encoding
Content-Encoding: gzip    <<<-------
Date: Sun, 10 Jun 2018 01:13:40 GMT
Connection: keep-alive
Transfer-Encoding: chunked

so i dont know whats going on there.
i am using:

express 4.16.0
compression: 1.7.2
node: 8.11.2

i have made a demo https://github.com/pYr0x/express-gzip
even on that simple example, chrome and other browers dont show the Content-Encoding.
if i visit other global website e.g. https://www.nytimes.com/ i see a content-encoding: gzip so a bug in chrome can be excluded.
the only difference on the respone headers i found is that:

content-length is missing
and there is a Transfer-Encoding: chunked header.

can  Transfer-Encoding: chunked be the reason why the Content-Encoding is not shown or ignored by chrome?
@dougwilson is the demo shown you the Content-Encoding? i am on windows 10 with chrome 67.0.3396.79

Thanks for providing a repo! I an getting Content-Encoding: gzip in the Chrome Console just as I would expect from your project:

you are on windows right?
what node and npm version do you have installed?

Yes, I am on Windows 10. I used Node.js 8.11.2 (installed fresh just for this) so we would be using the exact same Node.js to try and keep every as similar as possible from what you said so far.

So I have no glue what’s going on... :(

Same. Variations of this issue have been report many times but either it suddenly started working and the reported doesn't know why or I had to close due to no further progress. If I could reproduce it I could try to track it down, otherwise since you can reproduce it we're all awaiting to hear what the issue is that you're having and where the bug is located.

ok one last try:

can you disable all chrome extensions and try it with a clean chrome browser?
can you tell me the file size that chrome gets with gizp? i will compare that with the filesize i will get.

Hi @pYr0x sorry I didn't get back to you earlier. I just tried out your additional suggestions and everything is still working fine for me.
I did the following:

Installed a brand new Windows 10 on an old machine.
Installed a new copy of Google Chrome
Installed a fresh copy of Node.js
Ran the code I posted above and opened Chrome

This means that nothing I had on my machine before was preset. There were no extensions in Chrome now, as it's a fresh install on a fresh Windows 10 install.
The file size that Chrome is showing with gzip is 87.9 kb.

Closing stale issue.

repo: expressjs/compression


text:
promises

now that promises are going mainstream, i'm trying to think of how to make express more async friendly. an idea is to use promises.

next() now returns a promise
if middleware returns a promise, that promise is resolved and propagated up next()s

app.use(function (req, res, next) {
  // a promise must be returned,
  // otherwise the function will be assumed to be synchronous
  return User.get(req.session.userid).then(function (user) {
    req.user = user
  })
  .then(next) // execute all downstream middleware
  .then(function () {
    // send a response after all downstream middleware have executed
    // this is equivalent to koa's "upstream"
    res.send(user)
  })
})

Error handlers are now more koa-like:
app.use(function (req, res, next) {
  return next().catch(function (err) {
    // a custom error handler
    if (res.headerSent) return
    res.statusCode = err.status || 500
    res.send(err.message)
  })
})

app.use(function (req, res) {
  throw new Error('hahahah')
})

Pros:

it should be backwards compatible since you don't have to resolve the promise returned from next()
much easier error handling including throwing
solves issues shown in https://github.com/visionmedia/express/issues/2255
no more fn.length checking ~_~
could probably easily upgrade to es7 async functions

Cons:

promises
upgrading middleware and supporting both signatures might be a pain in the ass
probably a lot slower

Looks promising! (sorry)
Just as a data point, here is a framework that uses a WSGI-like setup. Basically, you make a chain of middlewares that optionally modify the request before passing it down the chain and then optionally modify the response before passing it up the chain.
The response is a simple object with the headers and an iterable body, and once the entire chain ran it is sent to the user. You can't have "headers already sent" errors, and error handling is a lot cleaner.
The interesting bit is that middleware can return promises for the header or body parts, and they are sent as soon as they resolve. This makes for very simple code.
I wonder if Express can be made to do the same while retaining the res API for middleware.

Why not giving users the ability to set our own trigger handler?
Something like this would be easy to implement, and wouldn't hit the performance (and could have other interesting usages, such as intercepting the routing and monitoring action perfs):
app.wrap(function (action, req, res, next) {
    var res = action(req, res, next);
    if (res && res.then) {
        res.then(function () {
            next();
        }, function () {
            res.status(500);
        });
    }
})

It would be a simple feature which would allow us to start using promise, until you decide if/how you want to support promises in the Express core. Would you consider a PR?

This issue is pretty old. Promise support will be coming in Express 5.

Really? It has not been listed on the related issue. Are they already supported, or just planned?

@arcanis sorry, I didn't add it. Promise support should be listed in the 5.0 issue now.

@arcanis I must admit I don't understand how your code works (what does app.wrap do?)
I use promises with Express by wrapping handlers (easy in coffeescript):
Q = require 'q'

class HTTPError extends Error
  name: "HTTPError"
  constructor: (status, message) ->
    if +status >= 100
      @status = status
    else
      @status = 500
      if status
        message = status
    @message = message

class NotFoundHTTPError extends HTTPError
  name: "NotFoundHTTPError"
  constructor: (message) -> super 404, message

httpErrorHandler = (err, req, res, next) ->
  if err instanceof HTTPError
    res.send err.status, err.message
  else
    next err

promiseJson = (fn) ->
  (req, res) -> res.json Q.fcall fn, req

app.use (require 'express-promise')()
app.use httpErrorHandler

app.get '/foo/', promiseJson (req) ->
  if idontwanttoanswer
    throw new NotFoundHTTPError "these are not the droids you're looking for"
  # some code that returns a value or a promise
  ...

@wmertens It's only a proposal. It would define how should the middlewares be called by the router. The default one would just pass the parameters to the actual middleware functions, but a more sophisticated one could just as well expect the middleware to return a promise, and 'convert' that promise to a callback.
But it's not so important if core promise support are on their way. Just something that I think could be interesting.

In case anybody ends up on this thread looking to use promises in Express right now, I've written an article here on exactly that, using express-promise-router.
Might be a useful stop-gap solution for some people, even if it doesn't completely implement them as described here :)

+1

i.m.o we can't really have it until joyent/node#7714 is fixed (or at least, promised to be fixed).

Why not Bluebird?

https://www.npmjs.com/package/native-or-bluebird

Any update on this?
And btw since no one mentioned it, the .catch() error handler style could be achieved with next() callback style too in theory, by allowing to pass a callback to next().

I've been trying to get this merged into pillarjs/router (see

Any updates on this? Would be nice if middleware could return a promise as an alternative to calling next()/next(err).

Can I take care of it if nobody is working on it?

There are a few PRs both here and in https://github.com/pillarjs/router . I plan to merge in basic support to 5.0 over the weekend, likely https://github.com/pillarjs/router/pull/32 without the upstream support (for now), since upstream has a lot more kinks to work out.

In the mean time, for express 4, we have monkey patched Layer to wrap handlers with code that does exactly what we want:
https://gist.github.com/q42jaap/f2fb93d96fda6384d3e3fc51977dec90

We have been using https://www.npmjs.com/package/async-middleware for quite a while now, it just wraps middlewares explicitely without any monkey patching

Hoping to add something like this into kraken-js https://github.com/krakenjs/kraken-js/issues/495

Any word on this? There's a ton of middlewares and such, but this would be nice to get in mainline express.

https://github.com/pillarjs/router/pull/60
It is lined up for the 2.x version of router, which will land in express 5.

Any updates on when promise support will land in Express 5?

The basic support is merged to the router 2.x branch.  https://github.com/pillarjs/router/pull/60
There is one other open PR over there, but nce the beta for that is released I think we can release another prerelease version of express 5.  I am not sure if @dougwilson has a concrete timeline on that.

I'm going to close this issue now that Express.js 5.0.0-alpha.7 has been published which includes the initial support for Promises in the router. Middleware and handlers can now return promises and if the promise is rejected, next(err) will be called with err being the value of the rejection. The implementation is seeking feedback from real usage, and please open any feedback as a new issue, either in this issue tracker or in the router issue tracker.
I am currently working on writing up Express.js-specific documentation on this feature, but in the meantime, the documentation can be found in the router repository:
https://github.com/pillarjs/router/tree/v2.0.0-alpha.1#middleware

The function can optionally return a Promise object. If a Promise object is returned from the function, the router will attach an onRejected callback using .then. If the promise is rejected, next will be called with the rejected value, or an error if the value is falsy.

Is there a single example of a route using Promises? I've read the router changelogs etc, from alpha 2 to alpha 7, but I can't find anything.
I know, eg, https://arc.codes uses
exports.handler = async function http(request) {
  return {
    status: 201,
    type: 'text/html; charset=utf8',
    body: `
      <!doctype html>
      <html>
        <body>hello world</body>
      </html>
   `
  }
}

Does express 5 allow me to return a response from a route?

Asked a question about generally getting rid of callbacks here (so we can just return a response) but deleted it - filed it as a new issue #3884 instead.

authors: ChiperSoft JessieAMorris affanshahid ahmetatar arcanis calebmer dougwilson felixfbecker gtomitsuka joepie91 jonathanong listepo mikemaccana olalonde q42jaap wesleytodd wmertens xjamundx

repo: expressjs/express


text:
Regression bug when exception is thrown

There seems to be a regression around the core engine handling exceptions. Given this test program:
function greet() {
  throw new Error('hello')
}

module.exports = { greet }

Output is:
2024/03/23 09:33:11 No runtime detected
2024/03/23 09:33:11 Calling function : greet
Error: wasm error: unreachable
wasm stack trace:
	.$1151(i32,i32,i32,i32,i32,i32)
	.$1290(i32,i32)
	.$1309(i32,i32,i32,i32,i32)
	.$1357(i32) i32
	.$1374() i32

We should see the exception

Should be fixed in #57

repo: extism/js-pdk


text:
[NERDTree] "Press ? for help" appear in the wrong buffer

Hi! First, let me thank you a lot for your awesome GUI, even if it is still in development/beta, it looks really cool (I tried first Nyaovim, and was a bit disappointed x) ).
Now, when I open neovim, I have automatically NERDTree opened, but there is a little graphic issue when using Oni:

When I write on the buffer, it replaces these letters, so it really looks like a graphical issue as it is not in the buffer. I have updated to the latest npm package for oni, and for neovim and NERDTree too
(By the way, I am on Linux Mint 18)
Here is my .vimrc if you need https://github.com/Ilphrin/.vim/blob/master/vimrc

Hi @Ilphrin ! Thanks for the kind words!
Yes, this definitely looks like a rendering bug. I believe I hit this on Windows too on startup - it seems like the beginning of the first line is always problematic. It might be we're missing or not handling one of the neovim msgpack-RPC actions correctly.

You're welcome! When i'll have time, i'll try to give some help on Oni, this really deserves more hands =D
BTW, when i run Ctrl+L it is refreshing the page and the glitch doesn't appear anymore, as my NERDTree is has a plugin to be launched in every tab and on startup, maybe it is because the browsers draws too soon the content? (Just suppositions, I don't know a thing about what's is happening!)

Awesome, would be great to have the help! :)
I just checked out this issue... It looks like it was a bug that was caused by a couple of contributing factors:

On startup, we would tell Neovim that we had a fixed size screen (80 cols x 40 rows), and then we would always resize to the proper size based on the font afterwards
During resize, Neovim sends a CLEAR action via the msgpack-rpc API. For that action, the cursor position wasn't being reset - so after clearing, it would just start rendering the first line whereever the cursor had been previously. So that was the root problem, and easy to fix.

Should be addressed now by PR #115


text:
🛑 XYZ is down

In 7f9854c, XYZ (https://davidblue.xyz) was down:

HTTP code: 0
Response time: 0 ms

Resolved: XYZ is back up in acf45f3.

repo: extratone/up


text:
填入自定义规则后应用闪退

你正在使用哪个版本？
1.8.0
使用最新版本是否还遇到同样的问题？
是
你的手机型号和手机操作系统版本是多少？
一加7p h2os10
你遇到了什么问题？
填入自定义规则https://github.com/Loyalsoldier/v2ray-rules-dat/raw/release/geosite.dat
后应用频繁闪退，无法连接，点规则集闪退
你遇到的问题可以用固定步骤重现吗？

你正使用的配置

<!-- 请把你的配置文件复制至此 (建议把服务器和用户信息去掉) -->

你可以点击上面你提交的链接，就会发现啥都没有

你可以点击上面你提交的链接，就会发现啥都没有

有内容啊 怎么会啥都没有

repo: eycorsican/kitsunebi-android


text:
Call to undefined function SEOstats\Config\env()

I get this error when trying to access the GooglePageSpeesAnalysis

 $dotenv = new Dotenv\Dotenv('path to your .env'); $dotenv->load(); function env($config, $default) {     $config_value = getenv($config);     if(is_string($config_value) && (strlen(trim($config_value)) > 0)) {         return $config_value;     } else {         return $default;     } }
All you need to write this code where you are calling the Google Page Speed Analysis

Fix in https://github.com/eyecatchup/SEOstats/pull/150

Same issue here.

Same issue with examples : get-mozscape-metrics.php or get-google-pagespeed-analysis.php

authors: barryvdh besens fbarrento fnagel merajsiddiqui

repo: eyecatchup/SEOstats


text:
不支持taro next

问题描述
不支持taro next
复现步骤
[复现问题的步骤]
期望行为
运行正常
报错信息

系统信息
Taro CLI 3.0.0-beta.1 environment info:
System:
OS: macOS 10.15.2
Shell: 5.7.1 - /bin/zsh
Binaries:
Node: 12.14.1 - /usr/local/bin/node
Yarn: 1.21.1 - /usr/local/bin/yarn
npm: 6.13.4 - /usr/local/bin/npm
npmPackages:
@tarojs/components: 3.0.0-beta.2 => 3.0.0-beta.2
@tarojs/taro: 3.0.0-beta.2 => 3.0.0-beta.2
@tarojs/webpack-runner: 3.0.0-beta.2 => 3.0.0-beta.2
eslint-config-taro: 3.0.0-beta.2 => 3.0.0-beta.2
react: ^16.10.0 => 16.13.0
npmGlobalPackages:
typescript: 3.7.5
补充信息
Chart/index.js 因为react的引用问题已经改了
import React, {Component} from 'react';
import Taro from '@tarojs/taro'

上面的报错是改了之后的报出的

我升级了taro next也的确是同样的报错 2.x是正常

@BinZhiZhu
推荐使用 https://github.com/elvinzhu/techarts ，直接用taro写的，没有引用原生组件那些麻烦事

@BinZhiZhu
推荐使用 https://github.com/elvinzhu/techarts ，直接用taro写的，没有引用原生组件那些麻烦事

可以 我真准备不直接依赖taro 谢谢老哥

repo: eyelly-wu/taro-echarts


text:
Set milestones and goals

ping @lucasmezencio and @pedrochaves

Which type of milestones/goals do you think we can have?

I think this issue must be discussed internally.

authors: lucasmezencio pedrommone

repo: ezdeliveryco/snorlax


text:
[dcc32 Fatal Error] F2084 Internal Error: DBG3198

Hi, I tried build SpringAndMVC and I have this error final.Why?:)
Ales

You have installed and configured the latest versions of DMVC and Spring4D (release 1.2)?
Has this link Embarcadero that can help you: http://docwiki.embarcadero.com/RADStudio/Seattle/en/F2084_Internal_Error_-%25s%25d(Delphi)

Yes I have,I have the same problem in other project with TSession,

I have same problem with today Spring release/1.2 without DMVC.In Debug mode I get this error,in Release mode compiled ok.Delphi XE6

This is an error in the compiler (reported as https://quality.embarcadero.com/browse/RSP-14974)
The circumstances to cause this are listed in my comment on that issue.
If you follow my recommendation to build Spring4D and then only point to the dcu directory instead of adding the source directories to the library or search path it will not appear as far as I know.
However I removed the inline from the TCollections.Create* methods as they did not have much of a beneficial effect anyway so this error should be gone once you update to the latest commit in release/1.2

Thank you for response Stefan. Very enlightening.

authors: egroups ezequieljuliano sglienke talpa

repo: ezequieljuliano/DelphiLaboratory


text:
Initial Pi VideoCore and DMA support

DMA is just memory to memory transfers for now
VideoCore mailbox is functional

Very cool! Here's the output of the functions for boards I have lying around. It seems this "interrogation" can indeed be used to detect the available RAM like suggested in https://github.com/f-secure-foundry/tamago/pull/13#issuecomment-699247428.
However, other values, such a BoardModel/MACAddress/Serial/CPUAvailableDMAChannels look fishy.
Raspberry Pi 1 A
FirmwareRevision: 8 (dec)
BoardModel: 0
MACAddress: 0xb827ebc95629
Serial: 0
CPUMemory: 0x0, 0xc000000
GPUMemory: 0xc000000, 0x4000000
CPUAvailableDMAChannels: 0x7f35

Raspberry Pi 1 B
FirmwareRevision: 13 (dec)
BoardModel: 0
MACAddress: 0xb827ebf4f296
Serial: 0
CPUMemory: 0x0, 0x1c000000
GPUMemory: 0x1c000000, 0x4000000
CPUAvailableDMAChannels: 0x7f35

Raspberry Pi 1 B+
FirmwareRevision: 0x10
BoardModel: 0
MACAddress: 0xb827eb32d0cc
Serial: 0
CPUMemory: 0x0, 0x1c000000
GPUMemory: 0x1c000000, 0x4000000
CPUAvailableDMAChannels: 0x7f35

Heya, any thoughts on my change request?

Hey - the comments look good.  Got distracted with another project.  I'll work on making the changes.

I've pushed a change that I think addresses the review comments.

authors: abarisani kenbell prusnak

repo: f-secure-foundry/tamago


text:
unhandled exception: Login failed エラーが出てしまいます

（以下、「DMMGamePlayerFastLauncher」を「FastLauncher」と略させて頂きます）
Windowsを10から11にし、FastLauncherをまた使用しようとして
DMMGamePlayer5がインストールして正常に動作する状態でFastLauncherを
以前と同じ様にインストールしました。
しかし、どうやってもFastLauncherがログイン出来ないという様なエラーになり、
どのゲームをFastLauncherから実行してもログイン出来ないとエラーが出て、
0byteのcookie.bytesが作成されます。
正常にログイン出来ていた頃はサイズが13Kbyteほどありました。

DMMGamePlayer.exeは「C:\Program Files\DMMGamePlayer」、
データ類は「C:\Users\（ユーザー名）\AppData\Roaming\dmmgameplayer5」にインストールされていて、
ゲームデータ類は他のドライブにインストールしています。
バージョンは5.1.39です。
DMMGamePlayerFastLauncher.exeの場所は
「C:\Users\（ユーザー名）\AppData\Roaming\DMMGamePlayerFastLauncher」にインストールされています。
バージョンは4.6.0で、正常に起動出来ていた頃に使用していたものは1つ前の4.5.2ですが、
そのバージョンに戻してみてもダメでした。
DMMGamePlayerでログイン出来るのに何故FastLauncherでログイン出来ないのかまったく分かりません…。
よろしくお願いします。

DMMGamePlayer5、ログアウトしてログインしなおしたらデバイス認証が出て1/5になりました。
しかし、やはりFastLauncherは同じエラーが出てしまいます。
DMMGamePlayerでログイン出来るのにFastLauncherでログイン出来ないのかまったく分かりません…。

DMMGamePlayer ver.5.1.39 でこの不具合が発生するようです

ふぁ様
お返事ありがとうございます。
DMMGamePlayerがバージョンアップしたからなのですね…。
（余計な所ばかり改悪して、使いやすい様には改良しないんですねDMMの開発）
修正版作成、よろしくお願いします。
いつも使わせて頂いて感謝しております。


text:
Work item types vanish from work-item-quick-add list

To reproduce click on the empty space (next to labels) of any work item.

Good one @jarifibrahim

Tracking via https://openshift.io/openshiftio/openshiftio/plan/detail/1549


text:
Force fileMode for executable script

Fixes fabric8io/fabric8#5686

[merge]


text:
S2I not yet supported for the webapp-generator - for artefacts created from swagger-codegen

I decided to use swagger-codegen on a swagger.json I created
java -jar modules/swagger-codegen-cli/target/swagger-codegen-cli.jar generate -DdebugModels=true -i audit/swagger.json -l jaxrs -o samples/server/ob/jaxrs-spec
then used mvn io.fabric8:fabric8-maven-plugin:3.5.28:setup
then fabric8:run gave me the error:
[ERROR] Failed to execute goal io.fabric8:fabric8-maven-plugin:3.5.28:build (fmp) on project swagger-jaxrs-server: Execution fmp of goal io.fabric8:fabric8-maven-plugin:3.5.28:build failed: S2I not yet supported for the webapp-generator. Use -Dfabric8.mode=kubernetes or -Dfabric8.buildStrategy=docker for OpenShift mode. Please refer to the reference manual at https://maven.fabric8.io for details about build modes. -> [Help 1]
I seem to remember hitting this problem a few years ago and got around it by hacking on the pom file but it would nice not to have to

Possibly related PR: https://github.com/fabric8io/fabric8-maven-plugin/pull/1060

@stevef1uk does it work with mvn fabric8:run -Dfabric8.mode=kubernetes?

authors: jsight nicolaferraro stevef1uk


text:
fix(iteration): show date picker in create interation modal (fix #1341)

Previously we didn't allow the user to choose iteration date interval while creating the new iteration. Now this PR will allow the user to select the iteration date interval while creating the new iteration.

The date pickers should be empty on new iterations, not filled with a default date. Is that the case with this change? If no, can you add that? Thanks!

@michaelkleinhenz No, now date picker filled with a current date. and yes, I am adding that.

Current date/default does not show up when creating a new iteration:


text:
add ppath command

Print application's 'Documents' directory path.

@dopcn What do you think about having option flags to allow the desired directory to be opened in Terminal, or maybe Finder as well? For example ppath -t to open in Terminal. These don't need to be added to this pull request, but they'd be nice to add sooner or later.

@dopcn What do you think of the comments I made?

@kastiglione sorry, back and working on it now...

Update copy to the pasteboard before print

Thanks @dopcn, I'm happy to accept this. Before that, can you merge from master because there are now conflicts.

Thanks @dopcn!

authors: dopcn kastiglione

repo: facebook/chisel


text:
Can't run project

I can't run the server in this project. Please help me. This error bellow. Thank you so much
express-session deprecated req.secret; provide secret option index.js:64:9
/home/lap12703/Code/kahoot-clone/node_modules/passport-auth0/lib/index.js:36
throw new Error('You must provide the ' + k + ' configuration value to use passport-auth0.');
^
Error: You must provide the domain configuration value to use passport-auth0.

This is not an issue with create-react-app, you're probably running an express server and forgot to pass the express-session middleware a secret option. Refer to the express-session package documentation.

authors: josecarneiro todinhvin

repo: facebook/create-react-app


text:
Service Controller not rendering

Is this a bug report?
Yes
Did you try recovering your dependencies?
Yes, no issue with dependency.
Package.json
{
"name": "public",
"version": "0.1.0",
"private": true,
"homepage": "./",
"dependencies": {
"bootstrap": "^3.3.7",
"lodash": "^4.17.5",
"prop-types": "^15.6.1",
"react": "^16.3.2",
"react-dom": "^16.3.2",
"react-render-html": "^0.6.0",
"react-router-dom": "^4.2.2",
"react-scripts": "1.1.4",
"reactstrap": "^5.0.0-beta.3"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "jest",
"eject": "react-scripts eject"
},
"devDependencies": {
"babel-jest": "^22.4.3",
"babel-preset-env": "^1.6.1",
"babel-preset-react": "^6.24.1",
"jest": "^22.4.3",
"react-test-renderer": "^16.3.2"
}
}
12:22:10 › npm --version
5.6.0
Environment
Development
Steps to Reproduce

You launch react application
Let's say react is running on localhost:3000
Setup a proxy server which takes the request on localhost:4000.
All the request coming from localhost:4000/xyzabc should redirect to localhost:3000

Expected Behavior

Whatever coming on localhost:3000 should come on localhost:4000/xyzabc
Actual Behavior

JS CSS everything is getting downloaded but nothing is showing on UI. UI is totally blank

Reproducible Demo

(Paste the link to an example project and exact instructions to reproduce the issue.)

Closing as a duplicate of #4468, this is a known issue. Sorry!
It should be fixed in v2.


text:
Failed to compile after configuring rules

{
  "extends": "react-app",
  "rules": {
    "no-unused-expressions": "off"
  }
}

Failed to compile.
./src/components/Tree/index.js
Line 24:  Expected an assignment or function call and instead saw an expression  no-unused-expressions
Search for the keywords to learn more about each error.

Can you post your index.js file?

@bullettrang
class TreeItem extends PureComponent {
  render() {
    const { item, selected, isFirst, isLast, folded, onFold, onClickItem } = this.props;
    const { children, text } = item;
    let fragment;

    // 节点块样式
    let itemCls = isFirst
      ? isFirst === isLast
        ? 'l-onlychild'
        : 'l-first'
      : isLast
        ? 'l-last'
        : '';

    if (children) { // 文件夹
      const lastIndex = children && (children.length - 1);
      // 节点样式
      let expandCls = '';
      let folderCls = '';
      // eslint-disable-next-line no-unused-expressions
      folded
        ? (expandCls = 'l-expandable-close', folderCls = 'l-tree-icon-folder')
        : (expandCls = 'l-expandable-open', folderCls = 'l-tree-icon-folder-open');
      const isLastFolder = isLast;

where is the return statement for your render()?

https://stackoverflow.com/questions/53996916/unable-to-turn-off-eslint-no-unused-expressions
Did you already take a look at above link?
Also what happens if you put 'folded' on the same line with the ternary expression like below?
     // eslint-disable-next-line no-unused-expressions       folded ? (expandCls = 'l-expandable-close', folderCls = 'l-tree-icon-folder') : (expandCls = 'l-expandable-open', folderCls = 'l-tree-icon-folder-open');       const isLastFolder = isLast;
Seems like putting certain statements on a separate line throws the 'Expected an assignment or function call and instead saw an expression no-unused-expressions' as explained by the link below with the return statement.
https://stackoverflow.com/questions/53013437/expected-assignment-or-function-call-no-unused-expressions-reactjs

@bullettrang The issue means I disabled this eslint rule, but it was compiled failed.

authors: bullettrang fengxinming


text:
[docs] revert removal of newlines from html

An unintended change was merged in #6062

I'm not seeing the changed files here on GitHub. Can you clarify what snuck through?

@ianschmitz it seems to be something that husky is doing automatically, and unfortunately I'm unable to override it. The form tag is being converted to one line:
https://github.com/facebook/create-react-app/pull/6062/files#diff-167d7aa95e8f35443e07dd102611e442L48

Ah yes you mean prettier. I wasn't aware they format code blocks inside of markdown files: https://twitter.com/bohdan_kh/status/1012367393656483841.
You should be able to get prettier to ignore that code block and restore the formatting to how it was previously: https://prettier.io/docs/en/ignore.html#range-ignore

Do you mind using the range ignore instead to just cover the code block?

@ianschmitz, should be ready now (FYI). Cheers.

Hmm, i'm not sure why but something looks off in the docs in this PR:
https://deploy-preview-6386--create-react-app.netlify.com/create-react-app/docs/adding-custom-environment-variables
You'll see the section that was edited here looks broken compared to master:
https://facebook.github.io/create-react-app/docs/adding-custom-environment-variables

I was able to fix the new issue with the code displaying properly by adding space above and below the code block, but prettier is not being ignored. I think it may make sense to just leave this as is and close the PR, thoughts?

authors: JBallin ianschmitz


text:
ZEIT Now → Vercel

ZEIT has rebranded to Vercel.
This PR updates the deployment section to reflect the new name.

#9099 is a more comprehensive version of this

authors: eddiemonge sarupbanskota


text:
Navigate to page sections using # doesn't work

Have you read the Contributing Guidelines on issues?

[X] I have read the Contributing Guidelines on issues.

Prerequisites

[X] I'm using the latest version of Docusaurus.
[X] I have tried the npm run clear or yarn clear command.
[X] I have tried rm -rf node_modules yarn.lock package-lock.json and re-installing packages.
[ ] I have tried creating a repro with https://new.docusaurus.io.
[X] I have read the console error message carefully (if applicable).

Description
when you paste the url including the section, the browser doesn't navigate to the section mentioned after # in th URL
https://dev2-everoed.evero.com/docs/-screen-descriptions/billing/billing_billing_claimbatchpending#raise-issue-button
You can notice the scroll doesn't move down to the bottom of the page.
Reproducible demo
No response
Steps to reproduce

Open https://dev2-everoed.evero.com/docs/-screen-descriptions/billing/billing_billing_claimbatchpending
Click Videos on the right side
Copy the URL
https://dev2-everoed.evero.com/docs/-screen-descriptions/billing/billing_billing_claimbatchpending#raise-issue-button
Paste in new tab (Doesn't scroll to videos) as original page does

Expected behavior
scroll down to the section mentioned from the URL # value
Actual behavior
The scroll doesn't move down to the section
Your environment

Public source code: NA
Public site URL: https://dev2-everoed.evero.com/
Docusaurus version used: 3.0.0
Environment name and version (e.g. Chrome 89, Node.js 16.4): Chrome Version 118.0.5993.89
Operating system and version (e.g. Ubuntu 20.04.2 LTS): Windows

We  have created Test user account for you
Username: etester
Password: DocusaurusTest123!
Self-service

[ ] I'd be willing to fix this bug myself.

This is not a Docusaurus bug, but a bad config of your host.
Your host should serve the appropriate static html file built by Docusaurus, but does not currently and always serve first the html of your homepage. It's only React that finally fixes the UI by rendering the correct page client-side.
This can easily be seen because your homepage "flashes" when you load any page.
This is what I see if I disable JS for example.

If your host is configured properly then you should see the good page content even with JS disabled.
If you don't know how to host a static deployment, then use Vercel, Netlify or another CDN that does it correctly for you out of the box. We can't help you configuring appropriately your custom setup.

we have built custom compoenent to serve dynamic content.
This is our docusourus config file., package if you have can spot an issue please let me know.
The project was setup many years ago and I don't know what's the correct setup for it.
docusaurus.config.js
const path = require("path");
const isDevelopment = process.env.NODE_ENV == "development";

module.exports = {
  onBrokenLinks: "ignore",
  title: "Our Digital Learning Repository",
  tagline:
    "eVero Ed is home to eVero-made resources and provides quick access to guidance documents, videos and recordings, a listing of scheduled webinars, and detailed release notifications.",
  url: "https://evero.com",
  baseUrl: "/",
  baseUrlIssueBanner: false,
  favicon: "img/Ed_MorePolished2.svg",
  organizationName: "evero",
  projectName: "ed",
  customFields: {
    isDev: isDevelopment,
    devServer: "https://localhost:44312",
  },
  scripts: [
    {
      src: "/external/accessibe.js",
      async: true,
    },
    {
      src: "https://static.evero.com/evero-shared-all.js",
      async: true,
    },
  ],
  themeConfig: {

    navbar: {
      title: "eVero Ed",
      logo: {
        alt: "eVero Ed Logo",
        src: "img/FlatEd.png",
      },
      items: [
        {
          type: "doc",
          label: "Guidance",
          position: "left",
          className: "spacing-nav-item",
          docId: "home",
        },
        {
          type: "docSidebar",
          position: "left",
          label: "Screen Descriptions",
          sidebarId: "barScreenDescriptions",
          className: "spacing-nav-item",
        }
        ,
        {
          to: "videos-v2",
          label: "Videos",
          position: "left",
          className: "spacing-nav-item",
        },
        {
          to: "webinars",
          label: "Webinars",
          position: "left",
          className: "spacing-nav-item",
        },
        {
          type: "doc",
          label: "Release Notifications",
          position: "left",
          className: "spacing-nav-item",
          sidebarId: "barNotifications",
          docId: "releases",
        },
        {
          to: "contact-us",
          label: "Contact Us",
          position: "left",
          className: "spacing-nav-item",
        },
      ].filter((x) => !!x),
    },
    footer: {
      style: "dark",
      links: [
      ],
      copyright: `Copyright © ${new Date().getFullYear()} eVero Corporation`,
    },
  },
  presets: [
    [
      "@docusaurus/preset-classic",
      {
        docs: {
          sidebarPath: require.resolve("./sidebars.js"),
          // editUrl: "https://github.com/facebook/docusaurus/edit/master/website/"
        },
        blog: {
          showReadingTime: true,
          // editUrl: "https://github.com/facebook/docusaurus/edit/master/website/blog/",
        },
        theme: {
          customCss: require.resolve("./src/css/custom.css"),
        },
      },
    ],
  ],
  plugins: [
    require.resolve("docusaurus-lunr-search"),
    path.resolve(__dirname, "./plugins/event-plugin"),
    // '@docusaurus/plugin-google-gtag'
  ],
};

package.json
{
  "name": "evero-da-documentation",
  "version": "0.0.0",
  "private": true,
  "scripts": {
    "start": "docusaurus start",
    "build": "docusaurus build",
    "swizzle": "docusaurus swizzle",
    "deploy": "docusaurus deploy",
    "prodtest":"rm -r build & npm run build & cd build & npx http-server & explorer http://192.168.222.52:8081/"
  },
  "dependencies": {
    "@docusaurus/core": "2.4.1",
    "@docusaurus/plugin-content-pages": "2.4.1",
    "@docusaurus/plugin-google-gtag": "2.4.1",
    "@docusaurus/preset-classic": "2.4.1",
    "@fortawesome/fontawesome-svg-core": "^1.2.36",
    "@fortawesome/free-solid-svg-icons": "^5.15.4",
    "@fortawesome/react-fontawesome": "^0.1.15",
    "@mdx-js/react": "^1.6.21",
    "autocomplete.js": "^0.38.0",
    "clsx": "^1.1.1",
    "docusaurus-lunr-search": "^2.1.14",
    "lodash.debounce": "^4.0.8",
    "moment": "^2.29.1",
    "react": "^16.8.4",
    "react-big-calendar": "^0.33.5",
    "react-debounce-input": "^3.2.4",
    "react-dom": "^16.8.4",
    "react-router-dom": "^5.2.0",
    "use-debounce": "^7.0.0"
  },
  "browserslist": {
    "production": [
      ">0.2%",
      "not dead",
      "not op_mini all"
    ],
    "development": [
      "last 1 chrome version",
      "last 1 firefox version",
      "last 1 safari version"
    ]
  }
}

The bug is likely not in your docusaurus project, but in your hosting config. We can't help fixing it.
If you run docusaurus serve it should work fine.

repo: facebook/docusaurus


text:
Using SSR with Next.js: TypeError: undefined is not an object (evaluating 'editorState.getBlockTree(anchorBlockKey).getIn')

Do you want to request a feature or report a bug?
Bug
What is the current behavior?
When using server side rendering, Rich Text example ( https://github.com/facebook/draft-js/tree/master/examples/draft-0-10-0/rich ) throws this error when pressing enter and at other times.
If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem. You can use this jsfiddle to get started: https://jsfiddle.net/stopachka/m6z0xn4r/.

Use Next.js to setup SSR.
Create a component called RichText from example here ( https://github.com/facebook/draft-js/tree/master/examples/draft-0-10-0/rich )
When page refreshes from server using next.js development server, start typing in the rich text editor and hit enter.
You'll see these errors appear multiple times.

What is the expected behavior?
Not to have errors in the browser console.
Which versions of Draft.js, and which browser / OS are affected by this issue? Did this work in previous versions of Draft.js?
Draft.js version: 0.10.28
Browser: Chrome 71 & Safari 12.0.3
OS: Mac OS: 10.14.3
Not sure if this worked in previous version of Draft.js

This is a problem with server-side rendering. Not sure about the reason, but you can work around this by rendering the editor only on client side.
import dynamic from 'next/dynamic';
const NoSSREditor = dynamic(() => import('../components/Editor'), { ssr: false });

render() {
  return <NoSSREditor .... />
}

Works for me.

Thanks @svitekpavel! Working for me as well.

Hi @svitekpavel
I've tried your solution but unfortunately, I have an infinite loop when I'm starting my server. My memory is getting consumed very fast, and I cannot render a single page, until the server crashes.

Windows 10 x64 - 16 GB of RAM
Node.JS 12.8.0
Next.JS 9.0.3
Draft 0.11.0

Hi @svitekpavel
I've tried your solution but unfortunately, I have an infinite loop when I'm starting my server. My memory is getting consumed very fast, and I cannot render a single page, until the server crashes.

The rendering should not be called on server, so my best guess is that something else is wrong. Try to revert changes and get the server running normally. Then again try to change it.

authors: BrodaNoel CommerceOwl MBach svitekpavel

repo: facebook/draft-js


text:
Support for arrays in disjoint unions refinements

Flow version: v0.91.0
Expected behavior
With the following code, I would expect flow to understand how control flow interacts with the union type, and refine the associated function type to be compatible with the function invocations. That is, I would expect this code to not error.
type Args =
  [false, () => void] |
  [true, (number) => number];

function applyTheThing(...args: Args): number | void {
  const [acceptsMore, fn] = args;
  if (acceptsMore) return fn(100);
  fn();
}

Actual behavior
The above code snippet produces (see flow.org/try) the following error:
9:   if (acceptsMore) return fn(100);
                                ^ Cannot call `fn` because no arguments are expected by function type [1].
References:
4:   [false, () => void] |
             ^ [1]
10:   fn();
      ^ Cannot call `fn` because function [1] requires another argument.
References:
5:   [true, (number) => number];
            ^ [1]

The same applies if the array entries are dereference directly instead of first re-bound to local bindings (see flow.org/try).

@skeggse Correct. It errors to show you that flow isn’t smart enough to know it shouldn’t error. I realize it may seem unusual for this behavior to be expected but Flow tends to error when it can’t be sure something is safe.

Yeah that makes perfect sense - I wasn't sure how that example was intended to differ from the example I gave, as it was producing the same error.

This is one of the more frustrating parts of Flow that I've encountered. I would personally expect Flow to be able to refine the type of this:
const x: Array<string> | Array<Array<string>> = ['a'];

Similarly, I can understand why Flow isn't able to refine x to a specific type in the following example, but it's unclear to me why an error would be surfaced prior to me trying to do something with x that isn't valid for all possible types in the union.
const x: Array<string> | Array<Array<string>> = [];

Try Flow

authors: jimmydief skeggse vicapow

repo: facebook/flow


text:
Test if object, array or string.

Is there a way to check if a component is an object, array or string? This would be similar to chai's 'should.be.a' Ex.: validationResult.SSN[0].should.be.a('string').

No, there isn't. You'll find the list of all available matchers here: https://facebook.github.io/jest/docs/en/expect.html
You can also use plain JavaScript or helper library like lodash for that:
test('name', () => {
  // array
  expect(Array.isArray(['value'])).toBe(true);
  // string
  expect(typeof 'value').toBe('string');
  // object
  expect({value: 'value'}).toBeTruthy();
  expect(typeof {value: 'value'}).toBe('object');
})

Minor point - this doesn't help with promise results.
expect(somePromise).resolves.toBe(...) at this point there is no way to check type. If you don't care what the contents are but just that it is a string. I hoped expects.stringContaining("") to be a work around but that doesn't work either.

@abritinthebay I am in exact that situation and this is the first result in Google, maybe this should be reopened?

Certainly it should be thought about a bit more. My workaround was to add to the chain so that does the typeof part. eg:
expect(somePromise.then(data => typeof data)).resolves.toBe("object");

it works, but it's not exactly clean.

@thymikee Checking types of things is a common enough use case (universal) that there isn't really any excuse for a testing framework that lacks them. Your alternatives are unacceptable as we lose all context of what we are testing.
This expect(Array.isArray(['value'])).toBe(false); fails with
expect(received).toBe(expected)
    Expected value to be (using ===):
      false
    Received:
      true.

So we either get terrible assertion messages or we have to extend Jest to support these sorts of checks. Doesn't it make more sense for the maintainers of Jest to do this once as opposed to every person that uses requires these features implementing them on their own?

Create your own matchers with expect.extend then and publish as an npm module. If it gets popular, we may merge it to Jest core eventually ;)

A simple toBeType extension for those who want it

expect.extend({
	toBeType(received, argument) {
		const initialType = typeof received;
		const type = initialType === "object" ? Array.isArray(received) ? "array" : initialType : initialType;
		return type === argument ? {
			message: () => `expected ${received} to be type ${argument}`,
			pass: true
		} : {
			message: () => `expected ${received} to be type ${argument}`,
			pass: false
		};
	}
});

describe("testing extended expect", () => {
	it("tests normal types correctly", () => {
		expect("").toBeType("string");
		expect({}).toBeType("object");
		expect(1).toBeType("number");
	});
	it("tests array types correctly", () => {
		expect([]).toBeType("array");
	});
	it("works with promises", () => {
		expect(Promise.resolve([])).resolves.toBeType("array");
	});
});

Pretty simple to implement. Really should be in core tbh.

Thanks @abritinthebay

So I wrapped that up in an npm module if people want it:
https://www.npmjs.com/package/jest-tobetype

describe("assertion framework", ()=> {
 it("should check primitive types", () => {
   expect(expect.toBeA).toBeA("function")
  })
})

Failed: expect(...).toBeA is not a function
TypeError: expect(...).toBeA is not a function

I've been using toBeInstanceOf in my tests:
expect($wrapper.vm.countries).toBeInstanceOf(Array);

Create your own matchers with expect.extend then and publish as an npm module. If it gets popular, we may merge it to Jest core eventually ;)

Yeah, and might write your own jest framework, while you're at it.
This one just might top the worst answers you can get on GitHub.

So @abritinthebay did exactly what was requested by @thymikee (which was far more than the standard pull request).
Now that that brave soul did all the work, when can the rest of us finally get this matcher (without having to install yet another library)?  Are the maintainers still pushing the idea that this doesn't belong in Jest, or did this just fall off their radar?

We are pretty strict with what makes it into core and don't typically add sugar matchers. Jest core is a fairly large architecture and every matcher we add increases the maintenance cost
For sugar, we generally recommend https://github.com/jest-community/jest-extended

One man's sugar is another man's (or in this case, at least seven other people's) really useful and logical feature that belongs in the core library.
Obviously as a maintainer your vote trumps all of ours, and you have all sorts of concerns we don't so I fully respect that.  But I'd simply ask that you look at why everyone here considers this feature to belong in the core library (so strongly that one person jumped through multiple hoops to write the code for you).  There's a need here, and if you ignore it Jest core library users (and let's be honest, 90% of them will never even hear about jest-extended) will lose out.

As abritinthebay suggested, it's not really about sugar, it's about "necessary" and "unnecessary" (for the core library) sugar.  You've got a bunch of people in this thread saying "hey, being able to check all types is something that should be in the core of a testing library".
Listen to us or don't, again as maintainer you have lots of other concerns.  But I don't think the right response is to come say "your's is just inherently unnecessary sugar" when it's not inherent: it's 100% your call whether Jest can check all types or not.

I think this is the way to go :)
describe('type check', () => {
    test('should be type string', () => {
        expect(typeof '').toBe('string')
    })

    test('should be type number', () => {
        expect(typeof 10).toBe('number')
    })

    test('should be type boolean', () => {
        expect(typeof true).toBe('boolean')
    })

    test('should be type undefined', () => {
        expect(typeof undefined).toBe('undefined')
    })

    test('should be type object', () => {
        expect(typeof { foo: 'bar' }).toBe('object')
    })

    test('should be type function', () => {
        expect(typeof function() {}).toBe('function')
    })

    test('should be type null', () => {
        expect(typeof null).toBe('object')
    })
})

I refactored the implementation provided by @abritinthebay. It seems for me a little bit comfortable to work with.
`expect.extend({
toBeType(received, arg) {
const initialType = typeof received;
    const type = initialType === 'object'
        ? Array.isArray(received)
            ? 'array'
            : initialType
        : initialType;

    return {
        pass: type === arg,
        message: () => `Expected '${received}' to be type '${arg}'`
    };
}

});`

You should check out my module (linked above). It does a bit more than that. But if that works for you: use it!

I think this is the way to go :)
describe('type check', () => {
    test('should be type string', () => {
        expect(typeof '').toBe('string')
    })

    test('should be type number', () => {
        expect(typeof 10).toBe('number')
    })

    test('should be type boolean', () => {
        expect(typeof true).toBe('boolean')
    })

    test('should be type undefined', () => {
        expect(typeof undefined).toBe('undefined')
    })

    test('should be type object', () => {
        expect(typeof { foo: 'bar' }).toBe('object')
    })

    test('should be type function', () => {
        expect(typeof function() {}).toBe('function')
    })

    test('should be type null', () => {
        expect(typeof null).toBe('object')
    })
})

It's works like a charm as well as more readable and maintainable for the future.

I think this is the way to go :)
describe('type check', () => {
    test('should be type string', () => {
        expect(typeof '').toBe('string')
    })

    test('should be type number', () => {
        expect(typeof 10).toBe('number')
    })

    test('should be type boolean', () => {
        expect(typeof true).toBe('boolean')
    })

    test('should be type undefined', () => {
        expect(typeof undefined).toBe('undefined')
    })

    test('should be type object', () => {
        expect(typeof { foo: 'bar' }).toBe('object')
    })

    test('should be type function', () => {
        expect(typeof function() {}).toBe('function')
    })

    test('should be type null', () => {
        expect(typeof null).toBe('object')
    })
})

    test('should be type object', () => {
        expect(typeof { foo: 'bar' }).toBe('object')
        // passes
        expect(typeof ['foo', 'bar']).toBe('object')
        // passes
        expect(typeof null).toBe('object')
    })

😞

This is why I suggest my addon above: takes care of this.
InstanceOf is slightly better but prone to similar issues.

thanks for solution @abritinthebay

Another solution:
expect('example').toEqual(expect.any(String));
expect(123).toEqual(expect.any(String));

The second one would fail with:
    Expected: Any<String>
    Received: 123

It's extremely weird that Jest doesn't provide so basic functionality out of the box. It's a nonsense that you need to install a third-party library just to check the type of a variable in a clear and semantic manner.

authors: Billy- Temirtator abramz abritinthebay ahtashamabbasse alex-dixon amiteshore balovbohdan ecoker franciscop machineghost nithrm rickhanlonii slavafomin tfoxy thymikee vitaly-t

repo: facebook/jest


text:
feat(jest-cli): return results object from jest.run

Summary
This makes it easier to run Jest directly, like when wrapping it in a custom script.
Test plan
Tests passes as before.

The major disadvantage is that runCLI does not process the command line arguments and the functions that do that are not exported. I'd like to use run but unfortunately there is no way to find out if it was successful or not, unless I missed something.

authors: dlmr manu-st


text:
Remove duplicate 'the'.

Summary

before:
the the
after:
the

Codecov Report

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

@@           Coverage Diff           @@
##           master    #7546   +/-   ##
=======================================
  Coverage   67.91%   67.91%
=======================================
  Files         248      248
  Lines        9507     9507
  Branches        6        6
=======================================
  Hits         6457     6457
  Misses       3048     3048
  Partials        2        2

Impacted Files
Coverage Δ

packages/expect/src/matchers.js
99.39% <ø> (ø)
:arrow_up:

packages/jest-snapshot/src/index.js
52.63% <ø> (ø)
:arrow_up:

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 bfdd4e1...0d92c27. Read the comment docs.


text:
Bug: RTE components when resizing or scroll doesn't seem to be contained or collapsed

RTE components when resizing or scroll doesn't seem to be contained or collapsed.
Lexical version: 0.18.0
Steps To Reproduce

Go to the lexical playground and add lengthy texts to make it scrollable and table
Click on table dropdown and scroll the editor.
Now you'll see that dropdown is not being contained and not getting attached with table dropdown.

https://github.com/user-attachments/assets/cd24854e-8966-4cde-bc9f-abe4a399309d
Link to code example: https://playground.lexical.dev/

The current behavior
Components are not getting contained.
The expected behavior
Make it contained.
Impact of fix

can I work on this issue ?

repo: facebook/lexical


text:
Update anchor selection if split by patching style

Problem
Setting styles using $patchStyleText does not update the selection when the anchor node is split. This causes the selection to contain a node that is not part of the selection. As a result, the toolbar/$getSelectionStyleValueForProperty is not able to determine the correct selection style.
https://github.com/facebook/lexical/assets/1575198/e438e605-4d4d-4c78-9967-e3176ed531f8
Solution
Update the selection anchor with the new text node after splitting.
https://github.com/facebook/lexical/assets/1575198/22c177ae-fd17-4b30-bb68-2adab21a9b78

Failed tests seem spurious 😏


text:
Add BSER load/dump support for variants

BSER is a local-IPC only serialization format for dynamic data:
https://github.com/facebook/watchman/blob/master/BSER.markdown
Adding support for this to Phenom requires adding load/dump APIs similar to the JSON load/dump API.
It also means adding API support for "Array of Templated Objects".  In Watchman, this is achieved simply by storing the template definition as a special property of the object type.

Thank you for reporting this issue and appreciate your patience. We've  notified the core team for an update on this issue. We're looking for a response within the next 30 days or the issue may be closed.

repo: facebook/libphenom


text:
Issue with hotfix for w3c chromeOptions

What are you trying to achieve? (Expected behavior)
Adapt acceptance testing with Codeception for ChromeDriver v75, using webdriver v1.7.0.
What do you get instead? (Actual behavior)
In the code of the hotfix for w3c I get an error toArray() called on Array for Facebook\WebDriver\Remote\RemoteWebDriver line 112.
if (!isset($chromeOptions->toArray()['w3c'])) {
How could the issue be reproduced? (Steps to reproduce)

Using Codeception pass capabilities to chromeOptions
modules:
  enabled:
    - WebDriver:
        url: http://localhost:8000
        browser: chrome
        port: 9515
        restart: true
        capabilities:
          chromeOptions:
            args: ["--headless", "--disable-gpu", "--no-sandbox"]

Details

Php-webdriver version: 1.7.0
PHP version: 7.3
Operating system: Linux
Browser used + version: ChromeDriver v75

I believe the cause is that the hotfix assumes the class Facebook\WebDriver\Chrome\ChromeOptions is always used, but before the hotfix it allowed passing an array instead.

Ah, nevermind I see now it is fixed in main branch, just not released yet.

Yes, fixed in 1.7.1.
Ref. #642 .

Still no substance

authors: OndraM riotCode temptationdrops

repo: facebook/php-webdriver


text:
Fix theoretical memory tracking leak

DriverFactory is not guaranteed to be closed. It's only closed when all
splits have been received and drivers created for them. However,
several OperatorFactories rely on close() being called.
For example, LookupJoinOperatorFactory will "leak" memory in the memory
tracking system, if close() is not called.

looks good

authors: cberner dain

repo: facebook/presto


text:
update Docusaurus and other deps, fix broken styles

Why & how
Superseeds:

#3022

This PR updates Docusaurus to latest beta (beta.18) and most of the other dependencies.
Due to changes in Docusaurus code, I had to adjust the config and add a bunch of fixes to our custom styles, which become broken after the update. I also had to duplicate the GA move in the config, otherwise the website won't start.
Test plan
I have run the updated version of the website on localhost and I used the currently shipped website as a 1:1 comparison, so the style issues was easier to spot, however, there still might be small display problems which I was not able to catch. If you see any regression in preview deploy, please let me know!

I think this looks good! Are there particular places we should look for breakages? I guess, also should we confirm that GA tracking is working (tbh not sure how to do that)

Are there particular places we should look for breakages?

Generally every layout have at least one issue, sidebars too, only home page looks correct after upgrade, so it's hard to point on the specific thing. I usually test few pages, with focus on the origin diversity:

homage (custom JS)
versioned doc page (docs plugin)
blog post list and blog post (blog plugin)
community page (custom MD)

I guess, also should we confirm that GA tracking is working (tbh not sure how to do that)

The fix has been deployed yesterday in separate PR, so you probably should see a data spike on the GA dashboard now, if everything is working correctly.

Oh actually I do think I found an issue -- I thought it was a general issue but it's not reproing off prod: https://github.com/facebook/react-native-website/issues/3061

I have fixed the mobile menu hover issue and the deploy preview should be updated.
Please let me know, if now it looks fine for you.

authors: Simek lunaleaps

repo: facebook/react-native-website


text:
Jest coverage is throwing packager errors

Description
What I did
I added Jest to my project and started generating code coverage reports, which creates a folder named "coverage" at the project root.
What you expect to happen
I expected nothing to happen with the code.
What actually happens
Packager is looking at it for some reason, and it is causing an error.
TransformError /PATH/coverage/lcov-report/sort-arrow-sprite.png: Unexpected character '�' (1:0)

Reproduction
Having trouble reproducing.
Solution
The coverage folder should not be included in the packager logic or I should be able to ignore it. It’s unclear why it is looking in there as I have not linked to any files in the folder.
Additional Information

React Native version: 0.39.2
Platform: iOS
Operating System: OS X 10.12.3

cc @cpojer

I have since upgraded to 0.41.2 and am still experiencing the issue, so any additional notes may be applicable to only this newer version
Tried https://github.com/facebook/react-native/issues/7271#issuecomment-215375355 and it didn’t work
It throws the error when the coverage report is generated. If I hit reload, I can use my app just fine even though the offending .png is still present. It seems to be that the Packager file watcher is having/starting/causing the issue.

This worked for me http://stackoverflow.com/a/41963217/537998
This still feels like a bug to me, but I’ll close since the issue can be resolved.

this is more like a bug. Quite unintuitive to do this with every react native project

authors: ericvicenti kirkstrobeck rogerkerse

repo: facebook/react-native


text:
Prevent system font from overriding app font

I need to force app font inside the app and not to be overridden by system font. Namely font size and fontFamily. I also added the font I am using in assets and resources for android and iOS respectively.
rn: 0.42

Hey, thanks for reporting this issue!
It looks like your description is missing some necessary information. Can you please add all the details specified in the template? This is necessary for people to be able to understand and reproduce the issue being reported.
I am going to close this, but feel free to open a new issue with the additional information provided. Thanks!

authors: damathryx hramos


text:
Fatal Exception: java.lang.NullPointerException: Attempt to invoke virtual method 'double java.lang.Double.doubleValue()' on a null object reference

Environment
Binaries:
Node: 8.0.0 - /usr/local/bin/node
npm: 6.3.0 - /usr/local/bin/npm
SDKs:
Android SDK:
Build Tools: 23.0.1, 25.0.0, 25.0.1, 25.0.2, 25.0.3, 26.0.2, 26.0.3, 27.0.1, 27.0.3
API Levels: 23, 25, 26, 27
IDEs:
Android Studio: 3.1 AI-173.4907809
npmPackages:
react: ^16.4.2 => 16.4.2
react-native: ^0.56.0 => 0.56.0
Description
Fatal Exception: java.lang.NullPointerException: Attempt to invoke virtual method 'double java.lang.Double.doubleValue()' on a null object reference
at com.facebook.react.bridge.ReadableNativeArray.getDouble(ReadableNativeArray.java:114)
at com.facebook.react.bridge.JavaMethodWrapper$4.extractArgument(JavaMethodWrapper.java:64)
at com.facebook.react.bridge.JavaMethodWrapper$4.extractArgument(JavaMethodWrapper.java:60)
at com.facebook.react.bridge.JavaMethodWrapper.invoke(JavaMethodWrapper.java:359)
at com.facebook.react.bridge.JavaModuleWrapper.invoke(JavaModuleWrapper.java:160)
at com.facebook.react.bridge.queue.NativeRunnable.run(NativeRunnable.java)
at android.os.Handler.handleCallback(Handler.java:836)
at android.os.Handler.dispatchMessage(Handler.java:103)
at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(MessageQueueThreadHandler.java:29)
at android.os.Looper.loop(Looper.java:232)
at com.facebook.react.bridge.queue.MessageQueueThreadImpl$3.run(MessageQueueThreadImpl.java:192)
at java.lang.Thread.run(Thread.java:761)

+1


text:
Error calling JSTimers.CallTimers

Environment
[skip envinfo]
Description
I am trying to run my app on Android (One plus 6t). This was working fine before making a call to firebase but as soon as I add the line onSend={Fire.shared.send} to Chat.js, the app crashes. The logs just show Uncaught Error: Error calling JSTimers.CallTimers. Haven't seen this error anywhere else. Does anyone know what's the issue?
Reproducible Demo
Here's the snack: https://snack.expo.io/@adititipnis/community

i have same issue as you, any help?

Does anyone know a solution to this issue?

React Native Version: 0.59.9;
Platform: Android
Reproduce step:
1、 start an animation in react native view!
   Animated.timing(translateX, {
        toValue: 10,
        duration: 200,
        easing: Easing.inOut //  this config crash and throw Error calling JSTimers.callTimers
       // easing: Easing.in  //this config work well.
   }
 )

    render() {
        const { translateX } = this.state;
        const marginRight = translateX.interpolate({
             inputRange: [0,1],
             outputRange: [-100, 0]
        })
       return <Animated.View style={{marginRight}}>...</Animated.View>
    }

my same problem fixed by this way :
if (!isNaN(toValue)) {

    //start animation

}

//full code may be help you

const { duration, marqueeDelay, loop, isInteraction, useNativeDriver, easing, children, scrollingSpeed } = this.props
   this.setTimeout(() => {

     if (!isNaN(this.distance)) {
       Animated.sequence([
         Animated.timing(this.animatedValue, {
           toValue: this.distance,
           duration: duration || (this.distance) * scrollingSpeed,
           easing: easing,
           isInteraction: isInteraction,
           useNativeDriver: useNativeDriver
         }),
         Animated.timing(this.animatedValue, {
           toValue: 0, //-this.distance ,
           duration: duration || (this.distance) * scrollingSpeed,
           easing: easing,
           isInteraction: isInteraction,
           useNativeDriver: useNativeDriver
         })

       ]).start(({ finished }) => {
         if (finished) {
           this.hasFinishedFirstLoop = true
         }
         if (loop) {
           this.animateBounce()
         }
       })
     } else {
       this.start()
     }

   }, this.hasFinishedFirstLoop ? 0 : marqueeDelay)

authors: adititipnis cinder92 eleallegue luoyushouchai saeedhassankhan


text:
Could not find module ... for target 'x86_64-apple-ios-simulator'; found: arm64-apple-ios-simulator,

Description
Hello.
Context
We have RN iOS project with CocoaPods dependecies, but we want to add some dependencies via SPM.
In our Podfile, we have following lines:
 installer.pods_project.build_configurations.each do |config|
      config.build_settings["EXCLUDED_ARCHS[sdk=iphonesimulator*]"] = "arm64"
end

Without this lines — build fails by different errors from Pods
Right now if we will try to add SPM package to project, we have two scenarios:

Option 1 : Rosetta — turn on, project with connected SPM + Pods builds correctly. We don't want to use Rosetta at all
Option 2 : Rosetta — turn off, project build with connected SPM + Pods fails with an error Could not find module PACKAGE NAME for target 'x86_64-apple-ios-simulator'; found: arm64-apple-ios-simulator

What we want to achive
We want to be able to add SPM packages to Xcode project, continue to use Pods and don't use Rosetta . Does any one faced with this problem or has some solutions?
React Native Version
0.7
Output of npx react-native info
info Fetching system and libraries information...
System:
OS: macOS 13.1
CPU: (10) x64 Apple M1 Pro
Memory: 227.15 MB / 32.00 GB
Shell: 5.8.1 - /bin/zsh
Binaries:
Node: 16.20.0 - /usr/local/opt/node@16/bin/node
Yarn: 1.22.11 - ~/Documents/WORK/Breadfast/ReactNative-customer-app/node_modules/.bin/yarn
npm: 6.14.13 - ~/Documents/WORK/Breadfast/ReactNative-customer-app/node_modules/.bin/npm
Watchman: 2023.04.10.00 - /usr/local/bin/watchman
Managers:
CocoaPods: 1.11.3 - /usr/local/bin/pod
SDKs:
iOS SDK:
Platforms: DriverKit 22.2, iOS 16.2, macOS 13.1, tvOS 16.1, watchOS 9.1
Android SDK: Not Found
IDEs:
Android Studio: 2021.3 AI-213.7172.25.2113.9123335
Xcode: 14.2/14C18 - /usr/bin/xcodebuild
Languages:
Java: Not Found
Python: Not Found
npmPackages:
@react-native-community/cli: Not Found
react: Not Found
react-native: Not Found
react-native-macos: Not Found
npmGlobalPackages:
react-native: Not Found
Steps to reproduce

Xcode project generated by RN tools
Any SPM package
Turn off Rosetta on Mac

Snack, code example, screenshot, or link to a repository

Hi, you can use this in your podfile :
post_install do |installer|
      installer.pods_project.targets.each do |target|
        target.build_configurations.each do |config|
          config.build_settings["ONLY_ACTIVE_ARCH"] = "NO"
        end
      end
end


text:
uniq with an iteratee is uniqBy

The wrong version of the function was being used which was resulting in flow errors.
See https://lodash.com/docs/4.17.4#uniqBy for reference.
Test Plan
There should probably be a test for this. According to the lodash source, calling uniq with a second argument is not supported.
Flow correctly picks up on this, and is causing errors in my project.

I believe we merged similar PR a couple of weeks ago 🤔

Just found it. Seems we already have a PR that has been opened for a while (26 days). I don't want to discourage you, but I would prefer merging it that PR as far as it was the first one and we already reviewed it. Thanks for pointing out that we didn't merge it yet (in my mind we did haha)!
Hope to see more contributions from you in the future!

That's all good, just want to get it merged :)

authors: Kureev deecewan


text:
[TextInput] Add controlled selection prop

For prior discussion with @brentvatne @sahrens @yelled3 see #2478
Again, some notes and points for discussion:

I think using a NSDictionary is fine for the native prop type.
Should RCTTextView and RCTTextField share the implementation of setSelectionRange, or would that not be worth the effort? There's a little bit of duplication there.
In iOS you can set selectedTextRange to nil. It removes the cursor but keeps the input focused and available for inputs from the keyboard. I decided not to support it in this PR.

I'd love to follow this up with a PR for selection change events :smile:

Looks like some flow version change makes the e2e build fail: https://travis-ci.org/facebook/react-native/jobs/80185569#L929
I guess I'll just wait until that's resolved in master and re-run the build or rebase the PR?

LGTM @ehd

By the way, if there's any feasible way to offer the same functionality via an external npm package I'd also love to do that. I'm not sure whether it's possible to tie into native internals (I doubt it). I know that the maintainers are super busy right now and I'd like to test the API for a bit, let people try this out and maybe have someone contribute android parity.

Was curious about the status on this. Really excited about this feature! Hope to see it soon.

I'm going to rebase these changes on top of the current master soon.
@sahrens Since we talked in #2478, anything you want me to do to get this to review?

I merged these changes into my own branch and it worked great. The example in UIExplorer was helpful. The only gotcha for me was that at first I was trying to call setSelectionRange immediately after calling setState (in order to auto-insert a forward slash for a date). This did move the cursor properly which I'm guessing is due to the asynchronous nature of setState. This was solved by calling setSelectionRange either in componentDidUpdate or the setState callback.
This will be super helpful to start building some higher order text inputs with auto-insert and auto-complete. Nice job @ehd.

@brentvatne you think this could this be included in v0.14.0?

One question I have is whether the selection range should be a controlled prop. I bet there are some lessons learned from <Input> elements in the browser and whether a prop or an imperative method is preferable. Someone from FB UIE should take a look.
Otherwise this feature looks good... cc @sahrens

@ide I updated the PR to resolve the merge conflicts and update the warning log message text. Would be great to get some feedback regarding controlled prop vs. imperative method!

Have you looked into how this is going to work on Android? Ideally it should have the same API on both.

Have you looked into how this is going to work on Android? Ideally it should have the same API on both.

@mkonicek I haven't yet. I was thinking it would be great if someone familiar with Android development could look into this. Also, if they could comment on the user-facing API that would already help a lot, I think.

I'm really excited about the new rich text in TextInput support on iOS! Going to rebase this code on top of v0.15.0-rc and master tonight.

The implementation looks good to me as far as it goes. But I'm curious how this is used though without having an equivalent "onSelectionChange" event. It seems like you'd have no way of knowing what selection the user currently has, so you'd be overriding blindly, without being able to extend or restore the original values.
@ide's idea of making it a controlled property is also interesting - that would certainly make sense given how setting the text value works currently, as you'd probably want to implement text and selection updates in lock-step if you were doing something like real-time text replacement.

The implementation looks good to me as far as it goes. But I'm curious how this is used though without having an equivalent "onSelectionChange" event. It seems like you'd have no way of knowing what selection the user currently has, so you'd be overriding blindly, without being able to extend or restore the original values.

That is correct. This would make a lot more sense with the selection change event working. Can I ask: Is there any internal version on this? I've seen references to DocumentSelectionState. I'm happy to implement that event in this PR.

@ide's idea of making it a controlled property is also interesting - that would certainly make sense given how setting the text value works currently, as you'd probably want to implement text and selection updates in lock-step if you were doing something like real-time text replacement.

Like this, for example?
<TextInput
  selectionRange={[0, 3]} // Array variant
  selectionRange={{start: 0, end: 3}} // Object variant
  value='Foobar'
/>

Yeah, we do have a selectionChanged event internally. I'll add that to the open source version so we're consistent

Yeah, we do have a selectionChanged event internally. I'll add that to the open source version so we're consistent

That sounds great. So how about this:

onSelectionChange event and prop are added to the open source version
I make a controlled-prop version of selectionRange as @ide suggested, which is feasible with the event. I think I prefer that as an API.

Thats sounds good to me. @sahrens ?

I've landed the onSelectionChange event: https://github.com/facebook/react-native/commit/5a34a097f2d2324e5515e876a20fd5b7a376aa3e

@nicklockwood Thank you! I'll see to the controlled-prop API for selectionRange.

Apologies for the delay, I'm finally getting to this. Let me know if someone's got a better idea or a hot commit sitting somewhere. Otherwise I'll update the branch head to a new commit on top of the current master with this API:
class ControlledSelectionRange extends React.Component {
  state = {
    selectionRange: {start: 0, end: 0}
  }

  render() {
    return (
      <TextInput
        selectionRange={this.state.selectionRange}
        onSelectionChange={selectionRange => this.setState({selectionRange})}
      />
    )
  }
}

cc @nicklockwood @sahrens

Just resolved some merge conflicts with master. Now working on the API changes.

Since we're not going with the DOM API inspired naming anymore I'm changing the prop's name to just selection.

This turns out to be more difficult than I thought. I can't find a way to set selections programatically that won't also trigger the onSelectionChange event handler and thus cause a loop.
Similar to setText I'm comparing the input's current selectedTextRange, but this can't solve the problem of different selection change events causing overlaps and an change event -> set state -> change event -> set state loops.
Any ideas? I also commented here: https://github.com/facebook/react-native/commit/5a34a097f2d2324e5515e876a20fd5b7a376aa3e

Can't you filter out events that don't actually change anything? That
should be able to break any loops.
In general this seems like the right approach.
On Thursday, December 3, 2015, Stephan Seidt notifications@github.com
wrote:

This turns out to be more difficult than I thought. I can't find a way to
set selections programatically that won't also trigger the
onSelectionChange event handler and thus cause a loop.
Similar to setText I'm comparing the input's current selectedTextRange,
but this can't solve the problem of different selection change events
causing overlaps and an change event -> set state -> change event -> set
state loops.
Any ideas? I also commented here: 5a34a09
https://github.com/facebook/react-native/commit/5a34a097f2d2324e5515e876a20fd5b7a376aa3e
—
Reply to this email directly or view it on GitHub
https://github.com/facebook/react-native/pull/2668#issuecomment-161814405
.

@sahrens I tried doing that by comparing the requested selection range's start and end offsets with the textField or textView's current selectedTextRange start and end offset, but under certain circumstances they always perfectly did not match up properly. I also tried comparing with _previousSelectedRange but that didn't work either. I'll push what I tried in a bit.

:+1:

@ehd Any updates on this?

@satya164 I would get back to this next week, in vacation mode right now.

@ehd Awesome. looking forward to it.

Happy new year :wink: I'm on this again, @janmonschke is in, too! :smile:

Ouch, I think I got it... It works quite nicely, without a loop now. Here's what I did wrong in my setSelection method:
BAD:
_textView.selectedTextRange = selectedTextRange;
_previousSelectionRange = selectedTextRange;

GOOD (set the previous value first so the event handler won't trigger):
_previousSelectionRange = selectedTextRange;
_textView.selectedTextRange = selectedTextRange;

I didn't anticipate that the event handler would be called in the former case.
Polishing this now, then pushing to my branch and we can bikeshed on the API. Yay :fireworks:

This is the API:
<TextInput
  selection={{start: 0, end: 5}}
  value="Hello, World"
/>

There's an extensive demo in UIExplorer -> .
@satya164: This is working now!
@sahrens: Thanks for the hint again.
@nicklockwood: What do you think?

Hmm. How to handle changing the selection and value props at the same time, actually?

@ehd the selection should presumably always be applied after the value? It might make sense to use the didUpdateProps method instead of overriding the setText and setSelection setters, then you can ensure they are applied in the correct order.

Yeah, what @nicklockwood says. :+1:

the selection should presumably always be applied after the value?

Yep, that was my intuition. I think this would be the least surprising behaviour:

Set text only: Keep sensible selection (current behaviour from #4716)
Set selection only: Change selection
Set text and selection: Change text and selection

It might make sense to use the didUpdateProps method instead of overriding the setText and setSelection setters, then you can ensure they are applied in the correct order.

Oh yeah, that sounds interesting! This is what I understand the text setter is doing right now:

Ignore text update if there's event lag
Ignore text update if native text is the same value
Manage cursor and selection, changed recently in #4716 to "keep the distance of the cursor from the end of the text constant"

@nicklockwood I was trying to come up with a plan, but I'd like to clarify a few things first:

If we don't override the setters, where are we going to coordinate text and selection management in the native component? Where to compensate for lag and same-value updates?
Should there be a single native setter for changing both text and selection?

If possible I would also like to do something about the almost duplicate setText code in UITextField.m and UITextView.m.

@ehd you may still want to override one or both of the setters, but just do some extra logic in didUpdateProps (like actually applying the selection to the view).
Regarding duplicate logic - I suggest creating an RCTTextUtils file and moving any common logic into there as static C functions (much as we've done with RCTImageUtils).
Eventually, I'd like to combine RCTTextField and RCTTextView into a single class, but that's a big job that I don't think we're ready to do just yet.

@ehd you may still want to override one or both of the setters, but just do some extra logic in didUpdateProps (like actually applying the selection to the view).

@nicklockwood Could you give me an example of how to do that? For example, if I overwrote both setters I wouldn't know how to use them properly in didUpdateProps. Maybe didUpdateProps is something other than componentDidUpdate?

@ehd didUpdateProps: is a native method that you can define on RCTTextView. It will be called after the native prop setters have been called, and its parameter contains an array of all props that were updated.

@ehd Ah, sorry, it's called didSetProps:, not didUpdateProps:. My bad 😬
Example:

(void)didUpdateProps:(NSArray<NSString *> *)changedProps
{
if ([changedProps containsObject:@"selection"]) {
//set the selection
}
}

@nicklockwood Holy cow, exactly what we need, thanks!

@nicklockwood Do we need to implement both setters in any case, just so we can intercept the prop value and store it in an instance variable? Or is there another way to access the props (since changedProps just contains key names)?

@ehd Declaring NSDictionary *_selection; along with the other ivars in RCTTextView.m (line 64) should be sufficient. If the ivar exists, it will be set automatically by the view manager.

@nicklockwood Yup, that works nicely for storing the prop values!
So now most of setText is in didSetProps (event lag guard, set text, maintain selection). I'm adjusting it so it works for setting just text, just selection or both text and selection. I think that is the only way, because if text or selection are changed before didSetProps it's a mess to save intermediate values for those in more ivars (old selection, old length).
When that code works it'll move into a helper that's used from both TextView and TextField, probably also the rich text input handling in TextView.
One thing I haven't fully understood yet is _previousSelectedRange. Is it to prevent selection change loops?

@ehd it's just because textViewDidChangeSelection: sometimes fires in situations where the range hasn't actually changed, so I use that to verify that the new range is different before sending the event.

@nicklockwood I see, good to know! While working on this I've also observed selection changing to place the cursor at the end of the text when setting the selection prop, not sure yet why.

I did some research on the current onSelectionChange event behaviour comparing UITextField and UITextView. It seems to be inconsistent :cry:
How to reproduce:

Create a <TextInput>
Set value to "Hello World"
Focus by tapping on area right of text
Place cursor at "Hello| World" by hand
Set value to "Well, Hello World"
Results in cursor at "Well, Hello| World" (as per #4716)

The onSelectionChange events of a single line TextInput (UITextField):

{start: 5, end: 5} (from step 4)
{start: 11, end: 11} (from step 5)

Note that there is no selection change event caused by step 3 which is not what I expected. Imagine a Twitter-like completion UI where the value is "Hi @" with the cursor at "Hi @|", the completion would not know about the cursor position on focus and not provide a completion. A solution could be having to set a controlled selection prop to {start: value.length, end: value.length} in JS when needed.
The onSelectionChange events of a multiline TextInput (UITextView):

{start: 11, end: 11} (from step 2, not caused by step 3!)
{start: 5, end: 5} (from step 4)
{start: 17, end: 17} (from step 5)
{start: 11, end: 11} (also from step 5)

I did not expect the 17,17 event to appear, and it causes flickering & other problems when selection is a controlled prop. I haven't yet found out whether that behaviour is exhibited by UITextView itself or RCTTextView. The 11,11 event is originating from RCTTextView's cursor placement. The multiline TextInput emits selection events even if the field isn't focused, the single line TextInput doesn't. I suggest we consolidate these behaviours:

First: Can an unfocused field have a selection at all?
TextInput should emit an initial event when it's focused
TextInput shouldn't emit selection change events if field isn't focused
TextInput shouldn't emit multiple events on cursor correction

@nicklockwood Should single line and multiline emit the same events and behave the same way?

Any opinions on this?

@ehd, sorry I thought I'd replied :-/
Thanks for doing that research, and yes, ideally we'd want single line and multiline events to behave the same, and I agree with your suggestions for what the expected behavior should be.

@nicklockwood No worries, I really appreciate all your help and input! I'm going to look into normalizing the events :smile:

Thanks for working on this feature! I've been looking into what is needed for Android parity, has anyone taken a stab at it yet?

@ehd Since no one has chimed in, I've pushed a branch to do the most basic setting of text selection on Android. It currently sets the text selection directly in the property setter, as opposed to doing the event normalization described above:
https://github.com/Ginger-Labs/react-native/tree/text-input-set-selection-android
Let me know if this is useful. It does contain a bug that keeps the selection from sticking when the selection change immediately follows a user tapping to place the cursor. I found a suboptimal workaround for this (https://github.com/Ginger-Labs/react-native/tree/hack-to-fix-android-text-input-selection), but it is not the proper way to address the issue, which appears to come from somewhere deep in the redraw/input lifecycle.

Any update on whether / when this might get merged? This would be very helpful.

@cgilboy Thanks for doing the Android work :)
@joel100 Currently I got stuck before normalizing the selection change events. The selection prop won't work properly unless the events are emitted in a sound way, regardless of whether it's a single line or a multiline input.

@sahrens would you mind taking a look at this pull request? It's been a while since the last commit was reviewed.

I'll try assigning this to @sahrens as Nick has too many PRs to review. Do we want to proceed with this?

I did a really quick implementation for setting the selection on Android in https://github.com/exponentjs/react-native/commit/7a59fba694ee0bdeaa9f63e97033abdb2ea7c807 -- I'm happy to flesh it out to work the same as this one once this PR lands.

@brentvatne Do you know if this PR needs changes? Spencer commented 15 days ago and I added the Needs revision label based on his comment.

I'm actually not sure @mkonicek -- @sahrens @ehd - what's the status here?

FWIW this looks good to me. Nice work @ehd! @mkonicek The only change requested that is left was to switch to dot notation.
@brentvatne do you have a PR in for the Android side? 😁
Would love to see this land. Can't really do any input masking without this feature.

@ekryski - no PR for this yet but I'm going to have some cycles soon to clean up some of the stuff we've done on our internal fork so I made a note to come back to this one

Closing in favour of @janicduplessis PR's.

I can't figure out how to programatically call setSelection. It's not on the ref like .focus and .blur, would I have to use setNativeProps? Or is using the selection property the only way? I just needed a one time thing so I was trying the method call way.

Oh figured it out. Yep setNativeProps does the trick. Super cool thanks guys!
this.input.setNativeProps({ selection:{ start:1, end:1 } })

authors: Noitidart brentvatne cgilboy ehd ekryski esauter5 facebook-github-bot-7 ide janmonschke javache joel100 mkonicek nicklockwood sahrens satya164 webgoudarzi yelled3


text:
Fix hermes compilation in the react-native package

Summary

When releasing the latest RC, we have noticed pod install is broken since the downloaded react-native package is missing hermes scripts and shelljs dependency (needed by hermes-utils.js).
Changelog

[Internal] - Fix compiling hermes in the release version.
Test Plan

Run test-manual-e2e.sh with template and Hermes on iOS

Ooof, thank you for fixing this!

authors: fortmarek hramos


text:
[CI] Exit with the error status code from xcodebuild

See https://github.com/supermarin/xcpretty#usage -- xcpretty will suppress xcodebuild's status code so we need to add && exit ${PIPESTATUS[0]}.
Test Plan: Look at Travis CI results and see that an error with the Obj-C tests is properly reported as a CI error.

Let's see the CI results

Travis tests are green because the 2nd retry of the Obj-C tests actually succeeded. Not sure if this diff truly fixes the status code, but it can't make things worse.

Shipit :)
We will monitor stability over time
On Saturday, 23 April 2016, James Ide notifications@github.com wrote:

Travis tests are green because the 2nd retry of the Obj-C tests actually
succeeded. Not sure if this diff truly fixes the status code, but it can't
make things worse.
—
You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub
https://github.com/facebook/react-native/pull/7172#issuecomment-213714716

@facebook-github-bot shipit

authors: bestander ide