sharjeelyunus/github-issues-dataset huggingface dataset:
Repository: react
Issue: react-hooks/exhaustive-deps and useMemo(() => x, x)
Labels: Type: Feature Request

I would like to memoize an array using `useMemo(() => x, x)`, where x.length is unknown but constant, and so think I have a legitimate use case to be able to disable the eslint warnings.

I can find similar issues to this, including https://github.com/facebook/react/issues/18229#issuecomment-619569632, but not one where the length of the dependencies is unknown but constant.

This code creates a warning
> React Hook useMemo has a missing dependency: 'x'. Either include it or remove the dependency array.

and
> React Hook useMemo was passed a dependency list that is not an array literal. This means we can't statically verify whether you've passed the correct dependencies.

Which links to an issue with the following comment
> If you ... aren't sure your case is legit, file a new issue.
https://github.com/facebook/react/issues/14920#issuecomment-472018817

My use case, without the useMemo, is as follows:

```ts
/**
 * When an array in `arrays` goes from length 0 to length > 0, call `callback`
 */
export const useCallbackWhenAnArrayPopulates = (
  callback: () => void,
  ...arrays: (readonly unknown[])[],
) => {
  //  const memoArrays = useMemo(() => arrays, arrays);
  const prevArrays = useRef(arrays);

  useEffect(() => {
    if (prevArrays.current.length !== arrays.length) {
      throw 'Unexpected array length change in useCallbackWhenArraysPopulate';
    }
    if (
      prevArrays.current.some(
        (value, index) => !value.length && arrays[index]?.length,
      )
    ) {
      callback();
    }
    prevArrays.current = arrays;
  }, [arrays, callback]);
};
```

I would like to memoise `arrays`, which comes from spreading arguments passed to the hook, so that the useEffect is only called when one of these arguments changes. Ideally I'd do this with `useMemo(() => arrays, arrays)`.

I know that [the dependency length for useMemo can't change](https://github.com/facebook/react/issues/18229), but though it's length is unknown, I would not expect it to change and prevent this from happening by throwing an error if it does.

Is it safe to use `useMemo(() => arrays, arrays)` in this case, and disable the lint warning?

Example usage:

https://codesandbox.io/s/nervous-glade-qt4x2?file=/src/Counters.js

(side note, not shown in this example are cases where the arrays could change together and you wouldn't want to call the callbacks twice when this happens)
Repository: storybook
Issue: Test extract against legacy storybooks weekly (?) in CI
Labels: maintenance,canvas

https://www.notion.so/Test-Storybooks-for-Extract-QA-4a078b612db04fcfb1a42dadf083473c
Repository: next.js
Issue: getServerSideProps not called if book-ended by shallow routes. 
Labels: bug,Navigation,linear: next

### What example does this report relate to?

basic

### What version of Next.js are you using?

12.0.10

### What version of Node.js are you using?

16.7.0

### What browser are you using?

Chrome

### What operating system are you using?

macOS

### How are you deploying your application?

next dev

### Describe the Bug

Currently, I have an issue where if calling `router.push` is book-ended by calls to `router.replace` with `shallow: true`, it will stop `getServerSideProps` being called, causing the URL to update in the browser but the content of the page doesn't change.

### Expected Behavior

If I navigate to a page using push and shallow:false, I would expect `getServerSideProps` to always be called when going back. 

### To Reproduce

Here is the example I'm using currently to re-produce this issue:

If you're using the basic next template
```
npx create-next-app nextjs-blog --use-npm --example "https://github.com/vercel/next-learn/tree/master/basics/learn-starter"
```

Just add this to pages/post/[...slug].js

```
import router from 'next/router';
import Link from 'next/link';
import React, { useEffect, useRef, useState } from 'react';

export const getServerSideProps = (ctx) => {
  console.log('getServerSideProps', ctx.query);
  return {
    props: {
      page: ctx.query.slug[0],
    },
  };
};

const Post = (props) => {
  const [index, setIndex] = useState(0);

  const handleClick = () => {
    setIndex(index + 1);

    router.replace(`/post/${props.page}/clicks/${index + 1}`, undefined, {
      shallow: true,
    });
  };

  useEffect(() => {
    setIndex(0);
  }, [props.page]);

  return (
    <div>
      <h1>This is post {props.page}</h1>

      <h3>Clicks {index}</h3>

      <button onClick={handleClick}>bump</button>

      <Link href="/post/1" passHref>
        <a>
          Post 1
        </a>
      </Link>

      <Link href="/post/2" passHref>
        <a>
          Post 2
        </a>
      </Link>

      <Link href="/post/3" passHref>
        <a>
          Post 3
        </a>
      </Link>
    </div>
  )
};

export default Post;
```

To re-produce the normal behavior, click bump a couple of times, click another page link and click back. This will update the heading tag and call getServerSideProps each time `router.push` or history back is used. 

![Artboard](https://user-images.githubusercontent.com/2168465/154044614-758aadaf-1367-4cd7-affc-ccc6a0ec2c4a.png)

The unexpected behavior comes if you click bump a couple of times, click another page link, click bump a couple more times and then click back. The heading will update when `router.push` is called, but after history back `getServerSideProps` will not be called. Therefore although the URL changes, the content of the page doesn't. 

![Artboard2](https://user-images.githubusercontent.com/2168465/154044641-573d80f2-dc09-4ec0-ae8c-76cfd21fe56b.png)
Repository: react
Issue: Reset button on iOS time input does not return correct event value
Labels: Type: 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: React 17.0.2
IOS version: 14+

## Bug
For iOS(Safari and Chrom).
The reset button function does not work on the time input:

 If I change time to 00:31, reset directly, the time jumps back to 00:30, but the computer still shows 00:31.
When pressing reset on a time input, the onChange event is not fired.

![reset](https://user-images.githubusercontent.com/83808682/154050608-748e912a-c6c7-4cae-9d27-9a705762b6d2.PNG)

<!--
  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://stackblitz.com/edit/react-enuflz?file=src%2FApp.js
Pls try on iOS.

<!--
  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.
-->
Repository: next.js
Issue: <style amp-custom> is rendering multiple times.
Labels: bug,Pages Router

### Run `next info` (available from version 12.0.8 and up)

    Operating System:
      Platform: linux
      Arch: x64
      Version: #64~18.04.1-Ubuntu SMP Wed Dec 9 17:11:11 UTC 2020
    Binaries:
      Node: 15.11.0
      npm: 7.6.0
      Yarn: 1.22.17
      pnpm: N/A
    Relevant packages:
      next: 12.0.8
      react: 17.0.2
      react-dom: 17.0.2

### What version of Next.js are you using?

12.0.8

### What version of Node.js are you using?

15.11.0

### What browser are you using?

Chrome

### What operating system are you using?

Ubuntu

### How are you deploying your application?

Local

### Describe the Bug

Since global css import is currently not working (Refer to #10549) - I am trying to have a temporary fix by adding style to my `next/head`.
Pseudo-code:
```
<style amp-custom="">{` .test-2 { display: block } `}</style>
```

However, AMP validator is complaining that there is multiple `amp-custom` declared in the head. The other one always remains empty.

What is the standard practice of adding a style with `amp-custom`?


### Expected Behavior

I assume all the style should be merged into 1 style amp-custom.

### To Reproduce

Please check the reproducible issue in the following [CSB](https://codesandbox.io/s/amp-components-v12-forked-hmkpv?file=/src/pages/about.jsx)

And access the page at `https://hmkpv.sse.codesandbox.io/about?amp=1`, you'll notice the following;
![image](https://user-images.githubusercontent.com/5223310/154055471-e276df3d-d28f-4347-bc7e-57d564a61cbf.png)
Repository: yt-dlp
Issue: Filter for playlists
Labels: enhancement

### Checklist

- [X] I'm reporting a feature request
- [X] I've looked through the [README](https://github.com/yt-dlp/yt-dlp#readme)
- [X] I've verified that I'm running yt-dlp version **2022.02.04**. ([update instructions](https://github.com/yt-dlp/yt-dlp#update))
- [X] I've searched the [bugtracker](https://github.com/yt-dlp/yt-dlp/issues?q=) for similar issues including closed ones. DO NOT post duplicates
- [X] I've read the [guidelines for opening an issue](https://github.com/yt-dlp/yt-dlp/blob/master/CONTRIBUTING.md#opening-an-issue)

### Description

When using a URL that ends in "playlists", yt-dlp will correctly download all the individual playlists. The problem is, if you have a channel with multiple playlists, you might only want a few of them and ignore the rest.

If you put the playlist ID into the file used by --download-archive, it doesn't use that to skip the playlist.

For example, let's say I give yt-dlp the following URL:

https://www.youtube.com/c/RT/playlists

but I actually want to skip the playlists with the following IDs:

PLPszygYHA9K3A9AWcV0jS1g7SxLzkVPbY
PLPszygYHA9K3PT2mdYs5rvPgR1BL8qZ5O
PLPszygYHA9K2mGqhuGyfXFAdYDPhQiPew

There's currently no method of doing this that I could see.

If it's not possible to use --download-archive, perhaps a new parameter with **--skip-playlists _listFile_** that would look like:

```
skip-playlists.txt


playlist_youtube    PLPszygYHA9K3A9AWcV0jS1g7SxLzkVPbY
playlist_youtube    PLPszygYHA9K3PT2mdYs5rvPgR1BL8qZ5O
playlist_youtube    PLPszygYHA9K2mGqhuGyfXFAdYDPhQiPew
```
Repository: pytorch
Issue: N-dimensional Convolutions
Labels: module: convolution,triaged,enhancement

### 🚀 The feature, motivation and pitch

Motivation: https://discuss.pytorch.org/t/is-there-a-way-to-realize-4d-convolution-using-the-convnd-function/5999/4

In short, it would be nice to have a convolution that supports n-dimensional inputs.

### Alternatives

Apply 3D convolutions with different kernels multiple times to the same input.
Downside: Slow and user implementation necessary.

### Additional context

I don't know much about cudnn but at least n-dimensional conv's are mentioned in the API reference: https://docs.nvidia.com/deeplearning/cudnn/api/index.html#cudnnGetConvolutionNdDescriptor.
Repository: material-ui
Issue: TS Augmentation not working when adding new props in v5
Labels: status: expected behavior

### Duplicates

- [X] I have searched the existing issues

### Latest version

- [X] I have tested the latest version

### Current behavior 😯

When trying to add a new prop and customize it, TS will still complain this prop doesn't exist. The documentation lack some examples on how to add new props, it only shows how to add new variants. I tried with:

```ts
import '@mui/material/TableRow'

declare module '@mui/material/TableRow' {
  interface TableRowProps {
    clickable?: boolean;
  }
}
```

I also tried changing the `TableRowProps` to `TableRowPropsOverrides`, but it still the same.

I added the prop to my theme to style it:

```ts
MuiTableRow: {
    styleOverrides: {
      root: {
        height: '80px',
      },
      head: {
        height: 'unset',
      },
    },
    variants: [
      {
        props: { clickable: true },
        style: {
          '&:hover': {
            cursor: 'pointer',
          },
        },
      },
    ],
  },
```
I don't have any TS error on my theme override, but when using the component, TS throws an error saying the `clickable` prop doesn't exist:

![image](https://user-images.githubusercontent.com/28715087/154072812-8e1e185f-4bdb-4232-a2ea-919637edd629.png)


### Expected behavior 🤔

TS would allow this new added prop to the component

### Steps to reproduce 🕹

I created a codesandbox replicating the issue: https://codesandbox.io/s/mui-tablerow-wjem8?file=/src/App.tsx

### Context 🔦

I'm trying to add a new prop to a component and customize it. I don't want to wrap this component in a new custom component, I want to use the component directly from MUI with my customized theme

### Your environment 🌎

<details>
  <summary>`npx @mui/envinfo`</summary>

```
  System:
    OS: macOS 12.2.1
  Binaries:
    Node: 16.13.1 - ~/.nvm/current/bin/node
    Yarn: 1.22.17 - ~/.nvm/current/bin/yarn
    npm: 8.1.2 - ~/.nvm/current/bin/npm
  Browsers:
    Chrome: 98.0.4758.80
    Edge: Not Found
    Firefox: 97.0
    Safari: 15.3
  npmPackages:
    @emotion/react: ^11.7.1 => 11.7.1 
    @emotion/styled: ^11.6.0 => 11.6.0 
    @mui/base: ^5.0.0-alpha.68 => 5.0.0-alpha.68 
    @mui/icons-material: ^5.4.1 => 5.4.1 
    @mui/lab: 5.0.0-alpha.67 => 5.0.0-alpha.67 
    @mui/material: ^5.4.0 => 5.4.0 
    @mui/private-theming:  5.3.0 
    @mui/styled-engine:  5.3.0 
    @mui/system:  5.4.0 
    @mui/types:  7.1.0 
    @mui/utils:  5.4.1 
    @mui/x-data-grid: ^5.0.1 => 5.1.0 
    @types/react:  17.0.37 
    react: ^17.0.2 => 17.0.2 
    react-dom: ^17.0.2 => 17.0.2 
    typescript: ^4.2.4 => 4.5.2 
```
</details>
Repository: material-ui
Issue: Add eslint-plugin-material-ui
Labels: new feature,discussion

### Summary 💡

This issue is mostly here as an opportunity to evaluate the opposite to have a linter for Material UI, Base UI, Pigment CSS, etc. This linter would very likely be implemented with eslint.

### Examples 🌈

- https://www.npmjs.com/package/eslint-plugin-react-hooks
- https://nextjs.org/docs/app/building-your-application/configuring/eslint#eslint-plugin
- https://baseweb.design/getting-started/setup/#eslint-plugin-baseui
- https://tailwindcss.com/blog/introducing-linting-for-tailwindcss-intellisense

### Motivation 🔦

Ideas:

1. When using the unitless API, error with all non-integer or half-integer usage: `sx: { p: 1.4, m: 1.6 }`
2. Warn when using an invalid import path, e.g. breaking https://mui.com/material-ui/guides/minimizing-bundle-size/

  - https://github.com/mui/mui-toolpad/pull/3417/files#r1572992179

3. `styled(Box)` should really be `styled('div')`
4. Providing render functions to slots, this is wrong:

```jsx
  <TimePicker
    defaultValue={time}
    slots={{
      textField: (props) => (
        <TextField sx={{ width: 100 }} {...props} size='small' />
      ),
    }}
  />
```

Explored with a warning in #14748 but has false-positive, false-negative.
Repository: godot
Issue: Godot freezes on 2nd monitor not connected via docking station
Labels: bug,platform:windows,topic:porting

### Godot version

3.4.2, in 4.0 issue not present

### System information

Windows 10, 3 monitor setup, docking station

### Issue description

I'm using 3 monitors - two connected via Display port into docking station and one via HDMI straight into laptop. 

On those two everything works fine, but when moving whichever godot window onto the HDMI one, you cannot see any input reaction or anything moving.

### Steps to reproduce

1. Connect 1st monitor into docking station and 2nd straight into PC/laptop
2. Open godot editor on 1st monitor
3. ✔️ **Buttons react upon hover, you can click them, you can drag things**
4. Drag godot editor window on 2nd monitor
5. ❌ **Buttons don't react upon hover, you can click them but you won't see anything happening, you can drag things but you won't see anything happening**
6. Drag godot editor window back to the 1st monitor
7. Everything is working again
8. You can see, that changes you've done on the 2nd monitor did apply - e. g. you dragged items.
9. Change window size
10. Move the window to the 2nd monitor and make it fullsize by bringing it to edge of screen.
11. ❌ **Window content doesn't resize**
12. Try the same on the 1st monitor
13. ✔️ **Content does resize**

Same happens with running game - on 2nd monitor (straight into PC/laptop) you won't see player (or anything) moving, but after moving window back to the 1st one (docking station) you can see, that the player actually moved, you just didn't see it.

### Minimal reproduction project

_No response_
Repository: material-ui
Issue: Export theme augmentation from package
Labels: docs,typescript

Hello!
We are building a custom MUI theme to be used in our applications and we are taking advantage of the module augmentation feature of Typescript to add some color definitions and some typography variants.
Now that we are happy with the result we want to isolate the theme object in an external package to be installed in our applications. The issue is that when I work in the application project I cannot find my custom colours and variants...

Unfortunately I haven't found any useful documentation about this, so I have two questions:
- Is what we are trying to do feasible?
- Is there any recommendation to achieve this?

Thanks
Repository: flutter
Issue: iOS: Add ability to check if Voice Control enabled
Labels: c: new feature,platform-ios,framework,engine,a: accessibility,c: proposal,customer: money (g3),P3,team-ios,triaged-ios

Internal: b/242473326

<!-- Thank you for using Flutter!

     If you are looking for support, please check out our documentation
     or consider asking a question on Stack Overflow:
      * https://flutter.dev/
      * https://api.flutter.dev/
      * https://stackoverflow.com/questions/tagged/flutter?sort=frequent

     If you have found a bug or if our documentation doesn't have an answer
     to what you're looking for, then fill out the template below. Please read
     our guide to filing a bug first: https://flutter.dev/docs/resources/bug-reports
-->

## Use case

Sometimes it's useful to know, which of a11y features are currently enabled, to optimize semantics & resolve conflicts between Voice Over & Voice Control (Currently we use `!MediaQuery.of(context).accessibleNavigation` to optimize for Voice Control)  

Also this might be helpful to change UI for specific cases. For example in our app we have a big snappable sliver header, and `Swipe up` command is not enough to collapse it, while `Scroll down` command currently [doesn't work](https://github.com/flutter/flutter/issues/98500), so it would be handy to know, if Voice control enabled to temporarily disable snap.

<!--
     Please tell us the problem you are running into that led to you wanting
     a new feature.

     Is your feature request related to a problem? Please give a clear and
     concise description of what the problem is.

     Describe the alternative solutions you've considered. Is there a package
     on pub.dev/flutter that already solves this?
-->

## Proposal

Add ability to check if Voice control enabled (and probably any other Voice assistant, which behaves like this).
For example it might be in `PlatformDispatcher.instance.accessibilityFeatures.voiceControl`

<!--
     Briefly but precisely describe what you would like Flutter to be able to do.

     Consider attaching something showing what you are imagining:
      * images
      * videos
      * code samples

     Does this have to be provided by Flutter directly, or can it be provided
     by a package on pub.dev/flutter? If so, maybe consider implementing and
     publishing such a package rather than filing a bug.
-->
Repository: node
Issue: Fails to build on FreeBSD 13.0-RELEASE with LTO
Labels: build,freebsd

### Version

v17.0.1

### Platform

FreeBSD KGPE-D16 13.0-RELEASE-p6 FreeBSD 13.0-RELEASE-p6 #0: Tue Jan 11 22:16:55 CET 2022     root@KGPE-D16:/usr/obj/usr/src/amd64.amd64/sys/GENERIC  amd64

### Subsystem

_No response_

### What steps will reproduce the bug?

I'm building `www/node` port after adding `--enable-lto` to CONFIGURE_ARGS.

### How often does it reproduce? Is there a required condition?

Always.

The condition is that DTRACE option is enabled.

### What is the expected behavior?

Should build fine.

### What do you see instead?

`dtrace: failed to link script src/node_provider.d: invalid file type: out/Release/obj.target/libnode/src/node_dtrace.o`

### Additional information

_No response_
Repository: pytorch
Issue: Profiler crashes with ProfilerActivity.CUDA on AWS p4d.24xlarge with A100-SXM4-40GB
Labels: high priority,triage review,module: cuda,oncall: profiler

### 🐛 Describe the bug

1) fairseq-train is a command line tool that trains various (language) models, including GPT-3
2) it has --profile argument that uses old autograd profiler
3) I created a fork and replaced old autograd profiler with new profiler in this branch
https://github.com/pbelevich/fairseq/pull/3/files
4) It works perfectly on devgpu, no issues
5) But it always fails on AWS cluster with seg fault, but not immediately when training starts but somewhere in the middle(it may happen during forward or backward somewhere in the middle of the network)

Some examples of crashes P466026774 P466029480 P466029724

PS: If I remove ProfilerActivity.CUDA and use only ProfilerActivity.CPU then it works without any issues

### Versions

Don't have exact versions, the cluster doesn't exist anymore, but it was PT master somewhere in December 2021



cc @ezyang @gchanan @zou3519 @ilia-cher @robieta @chaekit @gdankel @bitfort @ngimel @nbcsm @guotuofeng @guyang3532 @gaoteng-git @orionr