profile
viewpoint
If you are wondering where the data of this site comes from, please visit https://api.github.com/users/fisherwebdev/events. GitMemory does not store any data, but only uses NGINX to cache data for a period of time. The idea behind GitMemory is simply to give users a better reading experience.
Bill Fisher fisherwebdev Facebook Richmond, CA

fisherwebdev/webmotion 7

Leap Motion JavaScript Experiments

fisherwebdev/react 6

React is a JavaScript library for building user interfaces. It's declarative, efficient, and extremely flexible. What's more, it works with the libraries and frameworks that you already know.

fisherwebdev/seeds 6

Backbone.js Twitter client

fisherwebdev/touchy 2

jQuery plugin for touch events

fisherwebdev/EnvJasmine 1

A headless, self-contained tool for JavaScript Testing.

fisherwebdev/flux-react-router-example 1

A sample app showcasing Flux with React Router

fisherwebdev/grunt 1

Grunt: a task-based command line build tool for JavaScript projects.

fisherwebdev/httparty 1

Makes http fun! Also, makes consuming restful web services dead easy.

fisherwebdev/jquerytools 1

The missing UI library for the Web

issue commentfacebook/jest

`requestAnimationFrame` callbacks are never called with legacy fake timers when advancing time

Thanks for the quick response.

Legacy timers do not support rAF:

I'm not sure why waitFor from @testing-library/dom was working before merged https://github.com/testing-library/dom-testing-library/pull/966 though. Maybe it just worked incidentally because we used to real setImmediate which would flush animation frames at some point (even though the timing would be completely off)

PR welcome!

Let me check if I can throw something together quickly. Not sure if this will be useful though since that would still require updating jest itself.

eps1lon

comment created time in 38 minutes

issue commentfacebook/jest

`requestAnimationFrame` callbacks are never called with legacy fake timers when advancing time

Legacy timers do not support rAF: https://github.com/facebook/jest/blob/d1882f2e6033186bd310240add41ffe50c2a9259/packages/jest-fake-timers/src/legacyFakeTimers.ts#L31-L40 (and jsdom uses its own setInterval, not the one exposed, so mocking one doesn't mock the other)

PR welcome!

eps1lon

comment created time in an hour

issue commentfacebook/react

React 18: react-router@v5 is breaking in the Strict Mode (strict effects)

We’re not yet asking application authors to try the release.

People won't listen (like me).

For example, TikTok has upgraded to React 18 already (https://twitter.com/Brooooook_lyn/status/1402632529270632456?s=20)

Since people want to try out fresh things immediately, I think a list of what is blocking people from upgrading is helpful and can reduce other one's time-wasting.

Jack-Works

comment created time in 2 hours

issue openedfacebook/react

Bug:

<!-- Please provide a clear and concise description of what the bug is. Include screenshots if needed. Please test using the latest version of the relevant React packages to make sure your issue has not already been fixed. -->

React version: 17.0.2

Steps To Reproduce

  1. Render a button and a scrollable list with a height of 150px. The list should contain an array of 15 items, making sure to set the key prop of each item to unique values.
  2. Observe that you can see around 8 of the original 15 list items in view.
  3. On clicking the button, insert 15 more items into the beginning of the list, once again making sure to set the key prop of each item to unique values.
  4. Observe that you can now see around 8 of the new list items in view.

<!-- Your bug will get fixed much faster if we can run your code and it doesn't have dependencies other than React. Issues without reproduction steps or code examples may be immediately closed as not actionable. -->

Link to code example: https://codesandbox.io/s/keen-sound-7q5yf?file=/src/App.js

<!-- Please provide a CodeSandbox (https://codesandbox.io/s/new), a link to a repository on GitHub, or provide a minimal code example that reproduces the problem. You may provide a screenshot of the application if you think it is relevant to your bug report. Here are some tips for providing a minimal example: https://stackoverflow.com/help/mcve. -->

The current behavior

If the scroll position is at the very top of a list, after inserting new items at the beginning of the list, the new items are now visible.

The expected behavior

If the scroll position is at the very top of a list, after inserting new items at the beginning of the list, the original items should remain visible.

NOTE: When the scroll position is 1 or more pixels from the top of a list, after inserting new items at the beginning of the list, the new items remain visible as expected.

created time in 3 hours

issue commentfacebook/react

React 18: react-router@v5 is breaking in the Strict Mode (strict effects)

Hi! Can you clarify what would be the purpose of an issue like this? We’re not yet asking application authors to try the release.

The Alpha is focused on the library maintainers, and there will be a several months period before the Beta. It’s expected things would need adjustment early on, and I’m worried making a list of popular libraries before the authors even got a chance to try the release might be a bit premature.

We are committed to working with library authors and helping find recommendations where they’re unclear, including on this issue tracker. I’m just not sure that making a public list is the right way to kick this off.

What do you think?

Jack-Works

comment created time in 3 hours

issue openedfacebook/react

React 18: react-router@v5 is breaking in the Strict Mode (strict effects)

https://github.com/ReactTraining/react-router/issues/7870

I do not have permission to post https://github.com/reactwg/react-18/discussions. Please open and pin a new issue in that repo to list all widely-used library that does not work with React 18 or need special handling.

created time in 5 hours

issue commentfacebook/react

Misleading error description when using wrong useRef

This issue seems to be solved by https://github.com/facebook/react/pull/18031

madroneropaulo

comment created time in 6 hours

pull request commentfacebook/jest

chore: Fix typo in jest.css

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. Please note this issue tracker is not a help forum. We recommend using StackOverflow or our discord channel for questions.

eltociear

comment created time in 8 hours

issue commentfacebook/jest

how can I cover the code for the callback function using JEST

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. Please note this issue tracker is not a help forum. We recommend using StackOverflow or our discord channel for questions.

BhattMeet98

comment created time in 8 hours

issue commentfacebook/jest

Installing for babel issue

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. Please note this issue tracker is not a help forum. We recommend using StackOverflow or our discord channel for questions.

landed1

comment created time in 8 hours

PR opened facebook/react

Dependabot/npm and yarn/fixtures/dom/handlebars 4.7.7

<!-- Thanks for submitting a pull request! We appreciate you spending the time to work on these changes. Please provide enough information so that others can review your pull request. The three fields below are mandatory.

Before submitting a pull request, please make sure the following is done:

  1. Fork the repository and create your branch from master.
  2. Run yarn in the repository root.
  3. If you've fixed a bug or added code that should be tested, add tests!
  4. Ensure the test suite passes (yarn test). Tip: yarn test --watch TestName is helpful in development.
  5. Run yarn test --prod to test in the production environment. It supports the same options as yarn test.
  6. If you need a debugger, run yarn debug-test --watch TestName, open chrome://inspect, and press "Inspect".
  7. Format your code with prettier (yarn prettier).
  8. Make sure your code lints (yarn lint). Tip: yarn linc to only check changed files.
  9. Run the Flow type checks (yarn flow).
  10. If you haven't already, complete the CLA.

Learn more about contributing: https://reactjs.org/docs/how-to-contribute.html -->

Summary

<!-- Dependabot npm and yarn fixtures dom handlebars 4.7.7 -->

+35 -4

0 comment

3 changed files

pr created time in 9 hours

PR opened facebook/react

Dependabot/npm and yarn/fixtures/dom/hosted git info 2.8.9

<!-- Thanks for submitting a pull request! We appreciate you spending the time to work on these changes. Please provide enough information so that others can review your pull request. The three fields below are mandatory.

Before submitting a pull request, please make sure the following is done:

  1. Fork the repository and create your branch from master.
  2. Run yarn in the repository root.
  3. If you've fixed a bug or added code that should be tested, add tests!
  4. Ensure the test suite passes (yarn test). Tip: yarn test --watch TestName is helpful in development.
  5. Run yarn test --prod to test in the production environment. It supports the same options as yarn test.
  6. If you need a debugger, run yarn debug-test --watch TestName, open chrome://inspect, and press "Inspect".
  7. Format your code with prettier (yarn prettier).
  8. Make sure your code lints (yarn lint). Tip: yarn linc to only check changed files.
  9. Run the Flow type checks (yarn flow).
  10. If you haven't already, complete the CLA.

Learn more about contributing: https://reactjs.org/docs/how-to-contribute.html -->

Summary

<!-- it hadn't been solved-->

+29 -3

0 comment

3 changed files

pr created time in 10 hours

issue commentfacebook/jest

Not able to mock timer with Jest version 27.0.24

I've got the same problem - but this is potentially a duplicate of https://github.com/facebook/jest/issues/11500. This same issue is being/has been discussed in the comments on that issue

manastunga787

comment created time in 11 hours

issue commentfacebook/react

useReducer's dispatch should return a promise which resolves once its action has been delivered

@mmnoo that's sort of what I was saying. Think of it is less as "rules", and think of it as "how is this going to potentially change behavior in my application?".

I can't give specifics, because I don't know your app and I don't know what side effects you're considering doing here.

If the "side effect" is logging to the console or writing to localStorage, then while it's technically "breaking the rules", it's meaningless in the grand scheme and won't cause bugs.

If it's, say, making an HTTP DELETE call at the wrong time... then that could be very bad for your app :)

So, try to think about behavior based on the stated way React is going to execute things, not "am I breaking the rules".

pelotom

comment created time in 12 hours

pull request commentfacebook/react

Fix typo

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks!

houssemchebeb

comment created time in 13 hours

pull request commentfacebook/react

Fix typo

<!-- 0 failure: 0 warning:

1 markdown notices DangerID: danger-id-stable; -->

Comparing: 1a106bdc2abc7af190b791d13b2ead0c2c556f7a...4b09c091809081be04a87986c45f8164a6ec7c0c

Critical size changes

Includes critical production bundles, as well as any change greater than 2%:

Name +/- Base Current +/- gzip Base gzip Current gzip
oss-stable/react-dom/cjs/react-dom.production.min.js = 126.89 kB 126.89 kB = 40.69 kB 40.69 kB
oss-experimental/react-dom/cjs/react-dom.production.min.js = 129.70 kB 129.70 kB = 41.61 kB 41.61 kB
facebook-www/ReactDOM-prod.classic.js = 406.00 kB 406.00 kB = 75.07 kB 75.07 kB
facebook-www/ReactDOM-prod.modern.js = 394.35 kB 394.35 kB = 73.25 kB 73.25 kB
facebook-www/ReactDOMForked-prod.classic.js = 406.00 kB 406.00 kB = 75.07 kB 75.07 kB

Significant size changes

Includes any change greater than 0.2%:

(No significant changes)

<p align="right"> Generated by :no_entry_sign: <a href="https://danger.systems/js">dangerJS</a> against 4b09c091809081be04a87986c45f8164a6ec7c0c </p>

houssemchebeb

comment created time in 13 hours

issue openedfacebook/jest

`requestAnimationFrame` callbacks are never called with legacy fake timers when advancing time

<!-- Love Jest? Please consider supporting our collective: 👉 https://opencollective.com/jest/donate -->

🐛 Bug Report

Callbacks scheduled with requestAnimationFrame are not called when using jest.useFakeTimers('legacy') and jest.advanceTimersByTime(17)

To Reproduce

test.each(["legacy", "modern"])(
  "%s fake timers wait for requestAnimationFrame",
  async (timerImplementation) => {
    jest.useFakeTimers(timerImplementation);
    let exited = false;
    // implemented in JSDOm with `setInterval(callback, 16.6666)`
    requestAnimationFrame(() => {
      exited = true;
    });

    jest.advanceTimersByTime(15);

    expect(exited).toBe(false);

    jest.advanceTimersByTime(2);

    expect(exited).toBe(true);
  }
);

Expected behavior

Tests pass with legacy and modern fake timers

Link to repl or repo (highly encouraged)

https://github.com/eps1lon/jest-fake-timers-request-animation-frame

envinfo

  System:
    OS: Linux 5.4 Ubuntu 20.04.2 LTS (Focal Fossa)
    CPU: (6) x64 Intel(R) Core(TM) i5-9400 CPU @ 2.90GHz
  Binaries:
    Node: 12.22.1 - ~/.nvm/versions/node/v12.22.1/bin/node
    Yarn: 1.22.5 - /usr/bin/yarn
    npm: 6.14.12 - ~/.nvm/versions/node/v12.22.1/bin/npm
  npmPackages:
    jest: ^27.0.4 => 27.0.4

created time in 13 hours

pull request commentfacebook/react

Fix typo

Hi @houssemchebeb!

Thank you for your pull request and welcome to our community.

Action Required

In order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you.

Process

In order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA.

Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with CLA signed. The tagging process may take up to 1 hour after signing. Please give it that time before contacting us about it.

If you have received this in error or have any questions, please contact us at cla@fb.com. Thanks!

houssemchebeb

comment created time in 13 hours

PR opened facebook/react

Fix typo

Summary

Fix typo in react-devtools-shared

+8 -8

0 comment

5 changed files

pr created time in 13 hours

issue commentfacebook/react

createPortal: support option to stop propagation of events in React tree

Hi. I just published a library and it contains a wrapper around Portals and it dodges this event bubbling behaviour by portal-ling the portal itself. I didn't really test the implementation but feel free to check it out.

image

Portal Renderer code - https://github.com/nibmz7/nimz-app/blob/main/core/utils/Portal/PortalRenderer.tsx Portal code - https://github.com/nibmz7/nimz-app/blob/main/core/utils/Portal/index.tsx The library if you intend to try it out - https://www.npmjs.com/package/nimz-utils

I haven't tried the library out myself actually 😅. If it doesn't work, you may copy for portals over to your project.

kib357

comment created time in 14 hours

issue commentfacebook/jest

changedSince should run everything if the package.json changes

I just saw that there's actually an option called includePaths in the code related to this diffing. Maybe we could expose it in the CLI and people can choose freely, it'll be less risky than trying to guess this package.json/lockfile thing, will be non-breaking, and pretty flexible to whoever different needs anyone has.

https://github.com/facebook/jest/blob/bc50e7f360ab1845abbaa0b3ad788caead0d3174/packages/jest-changed-files/src/index.ts#L36

@SimenB what are your thoughts?

lukeapage

comment created time in 14 hours

issue openedfacebook/react

React 18

Just a suggestion

In React 18 , React should accept extra params to setState function so dev can specify what changed in more general terms that he/she can use in React.memo() to determine if that changes should re-render the specific component with the new data

it should be something like this

setState(
  [...state.users, user], 
  {action:'USER_ADDED', id : 'some_id'}
);

the broadcast can be any arbitrary data

and then in the User component, we can catch that broadcast in React.memo() like this

const User= (user)=>{
   // component code   
}
export default React.memo(User, (prev, next, brodcast)=>{
  if(broadcast?.action === 'ACTION_ADDED'  &&  next.id !== broadcast.id){
   // should not re-render this component
   return true;
 }
 return false;
});

this should work with batch setState as well just instead of object, broadcast should have an array of broadcasts

this will save the devs from deep comparison of props if it holds a lot of data nodes in it.

created time in 14 hours

issue commentfacebook/react

useReducer's dispatch should return a promise which resolves once its action has been delivered

@markerikson that is a very useful explanation, thanks for taking the time to write it.

I think I have another solution to my specific problem that is less convoluted than a useEffect. (Munging ui (focus) state with data state as a tradeoff).

If I were to pollute my reducer with a side effect and there was no downside to redundant calls to that side effect, is there still a risk of issues with your understanding?

Just curious where rules can be bent. Not meaning to call all of FP ideology as I quite like it. Although when blindly followed anything start to feel that way :)

pelotom

comment created time in 16 hours

issue commentfacebook/jest

changedSince should run everything if the package.json changes

Also in very much need of this in a monorepo setup.

I'd say implementing this over the package.json would be simpler, as if it's done checking the lockfile there will be so many different formats to take into account: NPM shrinkwrap, NPM package-lock, Yarn Classic, Yarn Berry (not sure, but I guess it changed), pnpm (please!).

The downside of not checking the lockfiles is that if just the lockfile is updated (e.g security upgrades from Dependabot) then again it could lead to things breaking unexpectedly.

lukeapage

comment created time in 19 hours

issue commentfacebook/react

Feature request: Consider supporting AbortSignal/AbortController for cleanup

What’s the idiomatic way to do cleanup for things that aren’t async, but just require disposal?

Here is one example above (I like it and go back to it because I know it well - but it's similar for other sync APIs going forward):

const ac = new AbortController();
const { signal } = ac;
const element = getElementSomeHow();
element.addEventListener('click', onClick, { signal });
element.addEventListener('mousedown', onMouseDown, { signal });
element.addEventListener('mouseup', onMouseUp, { signal });
// eventually we want to cleanup
ac.abort(); // removes all listeners
benjamingr

comment created time in 20 hours

issue commentfacebook/react

Feature request: Consider supporting AbortSignal/AbortController for cleanup

@gaearon that's a good point, if you look carefully you'll see a bunch of the other APIs we have are more IDisposable than CancellationToken. The addEventListener example above is a good example.

Given the web converged on "disinterest semantics" for cancellation (cancellation is a request rather than an error) - the line between "cancellation" and "disposing a resource" is hair-thin (dispose a resource but cancel an action mostly).

However - for React in particular I think these sort of semantics make a ton of sense:

  • Something like IDisposable typically means "you have to dispose it now when the user does .dispose. It typically comes with life-time management guarantees (like try using in the JS proposal case) which is the opposite of what frameworks would want (to control the lifecycle).
  • Cancellation semantics like with AbortSignal mean "the producer upstream has expressed disinterest in this action" (data fetching, uploads, sockets listening, file actions, workers etc) - this gives React and the calling code a lot more flexibility.

<sub>Note: A logical next step is to loop in some more WHATWG involved folks. </sub>

<sub>Note 2: I'm happy to loop in some of the .NET folks as well as some of the .NET folks who moved from C# to TS if that'd help but I'd like to keep the scope of the ask/discussion here small - aligning React with web platform APIs with regards to AbortSignal. Stuff like explicit resource management would be great to have but would not map well to React's use case where the framework needs to control the lifetime of resources rather than the calling code. </sub>

benjamingr

comment created time in 20 hours

issue commentfacebook/react

Feature request: Consider supporting AbortSignal/AbortController for cleanup

I think conceptually it doesn’t feel like the right fit to me because (in .NET terms) effect cleanup is more like IDisposable than CancellationToken. But that’s just my hunch so I would need to see more comparisons to understand if there’s a real problem or I’m making it up.

benjamingr

comment created time in 20 hours

issue commentfacebook/react

Feature request: Consider supporting AbortSignal/AbortController for cleanup

What’s the idiomatic way to do cleanup for things that aren’t async, but just require disposal?

benjamingr

comment created time in 20 hours

issue commentfacebook/react

Feature request: Consider supporting AbortSignal/AbortController for cleanup

Yes, it's the undefined that's the problem for the cleanup case :)

I suspect it'll be even more so when concurrent mode becomes "the norm".

Though really - between "force everyone to return a function" and "take an AbortSignal argument like web APIs" I'd pick the latter as it makes for a much nicer API that "throws you to the pit of success" more often.

benjamingr

comment created time in 20 hours

issue commentfacebook/react

Feature request: Consider supporting AbortSignal/AbortController for cleanup

if react threw an error (at least in developer builds) if a function isn't returned from useEffect that would also be a nice change.

Hmm. I thought we are throwing an error if what you return is neither undefined nor a function.

benjamingr

comment created time in 21 hours