问:
WooCommerceNET API get categories FAIL with error
This is my code below to get all categories in Woocommerce :-

I am getting this error in try catch

"There was an error deserializing the object of type System.Collections.Generic.List`1[[WooCommerceNET.WooCommerce.v3.ProductCategory, WooCommerce.NET, Version=0.8.4.0, Culture=neutral, PublicKeyToken=ff41d0b6c937438d]]. Encountered unexpected character 'W'."

This piece of code :-

```<code>                                Dim ACategorys = Await mainwc.Category.GetAll(New Dictionary(Of String, String)() From {
                                 {"page", page},
                                 {"per_page", "100"}})
</code>```

Is there a way to put a condition that will allow a load of items that exist; that will not put the routine in a error state !

```<code> Dim rest As RestAPI = New RestAPI(BaseURL, Key, Secret, False)
                        Dim wc As WooCommerceNET.WooCommerce.v3.WCObject = New WooCommerceNET.WooCommerce.v3.WCObject(rest)

                        Dim ProductCategory As New List(Of WooCommerceNET.WooCommerce.v3.ProductCategoryLine)
                        ' Dim Categorys = Await wc.Category.GetAll(dic)

                        Dim Categorys As New List(Of Object)

                        Try

                            Dim pageNum As Integer = 1

                            While True
                                Dim page = pageNum.ToString

                                ' Dim ACategorys = Await mainwc.Category.GetAll()

                                Dim ACategorys = Await mainwc.Category.GetAll(New Dictionary(Of String, String)() From {
                                 {"page", page},
                                 {"per_page", "100"}})

                                If ACategorys.Count < 100 Then
                                    For Each item As Object In ACategorys
                                        Categorys.Add(item)
                                    Next
                                    Exit While
                                Else
                                    For Each item As Object In ACategorys
                                        Categorys.Add(item)
                                    Next
                                    pageNum = (pageNum + 1)
                                End If

                            End While

                        Catch e As Exception
                            Throw New Exception(e.Message)
                        End Try

                        Dim CategoryID
                        Dim SubCategoryID

                        Dim maincatIndex = 0

                        If DoNotUpdateCategories = False Then

                            For Each maincat In MaincategoryList

                                Dim ExistmainCategory = From m In Categorys Where m.name.Equals(MaincategoryList(maincatIndex).Trim()) ', StringComparison.OrdinalIgnoreCase)

                                If (ExistmainCategory.Count() = Nothing) Then
                                    Try

                                        Dim c1 As ProductCategory = New WooCommerceNET.WooCommerce.v3.ProductCategory() With {
                                          .name = MaincategoryList(maincatIndex).Trim()
                                          }
                                        CategoryID = Await wc.Category.Add(c1)

                                    Catch ex As Exception
                                        FileClose(30)
                                        FileOpen(30, D_Drive + "\compu\offline-items-errors.mainCATOGS." & TermNumber, OpenMode.Append, OpenShare.Shared)
                                        WriteLine(30, Now, sku, maincat, ex.Message)
                                        FileClose(30)
                                    End Try
                                Else
                                    CategoryID = ExistmainCategory.FirstOrDefault()
                                End If
                                Try

                                    Dim ProductCategory1 As New WooCommerceNET.WooCommerce.v3.ProductCategoryLine
                                    ProductCategory1.id = CategoryID.id
                                    ProductCategory.Add(ProductCategory1)

                                Catch ex As Exception
                                    '
                                End Try

                                If (maincatIndex = 0) Then
                                    Dim subcatIndex = 0
                                    For Each subcat In subcategoryList

                                        Dim ExistsubCategory = From m In Categorys Where m.name.Equals(subcategoryList(subcatIndex).Trim()) ', StringComparison.OrdinalIgnoreCase)

                                        If (ExistsubCategory.Count() = Nothing) Then

                                            If (Not String.IsNullOrEmpty(subCategory.Trim())) Then
                                                Try

                                                    Dim c2 As ProductCategory = New ProductCategory() With {
                                                  .name = subcategoryList(subcatIndex).Trim(),
                                                  .parent = CategoryID.id
                                                  }
                                                    SubCategoryID = Await wc.Category.Add(c2)

                                                Catch ex As Exception
                                                    FileClose(30)
                                                    FileOpen(30, D_Drive + "\compu\offline-items-errors.subCATOGS." & TermNumber, OpenMode.Append, OpenShare.Shared)
                                                    WriteLine(30, Now, sku, maincat, ex.Message)
                                                    FileClose(30)
                                                End Try
                                            End If

                                        Else
                                            Try
                                                SubCategoryID = ExistsubCategory.FirstOrDefault()

                                                Dim c2 As WooCommerceNET.WooCommerce.v3.ProductCategory = New WooCommerceNET.WooCommerce.v3.ProductCategory() With {
                                              .parent = CategoryID.id
                                              }
                                                Await wc.Category.Update(SubCategoryID.id, c2)

                                            Catch ex As Exception
                                                Throw New Exception(ex.Message)
                                            End Try
                                        End If

                                        If (Not String.IsNullOrEmpty(subCategory.Trim())) Then
                                            Try

                                                Dim ProductCategory2 As New ProductCategoryLine
                                                ProductCategory2.id = SubCategoryID.id
                                                ProductCategory.Add(ProductCategory2)

                                            Catch ex As Exception
                                                '
                                            End Try
                                        End If
                                        subcatIndex = subcatIndex + 1
                                    Next
                                End If

                                maincatIndex = maincatIndex + 1

                            Next
</code>```

Body:
This is my code below to get all categories in Woocommerce :-

I am getting this error in try catch

"There was an error deserializing the object of type System.Collections.Generic.List`1[[WooCommerceNET.WooCommerce.v3.ProductCategory, WooCommerce.NET, Version=0.8.4.0, Culture=neutral, PublicKeyToken=ff41d0b6c937438d]]. Encountered unexpected character 'W'."

This piece of code :-

                                Dim ACategorys = Await mainwc.Category.GetAll(New Dictionary(Of String, String)() From {
                                 {"page", page},
                                 {"per_page", "100"}})

Is there a way to put a condition that will allow a load of items that exist; that will not put the routine in a error state !

 Dim rest As RestAPI = New RestAPI(BaseURL, Key, Secret, False)
                        Dim wc As WooCommerceNET.WooCommerce.v3.WCObject = New WooCommerceNET.WooCommerce.v3.WCObject(rest)

                        Dim ProductCategory As New List(Of WooCommerceNET.WooCommerce.v3.ProductCategoryLine)
                        ' Dim Categorys = Await wc.Category.GetAll(dic)

                        Dim Categorys As New List(Of Object)

                        Try

                            Dim pageNum As Integer = 1

                            While True
                                Dim page = pageNum.ToString

                                ' Dim ACategorys = Await mainwc.Category.GetAll()

                                Dim ACategorys = Await mainwc.Category.GetAll(New Dictionary(Of String, String)() From {
                                 {"page", page},
                                 {"per_page", "100"}})

                                If ACategorys.Count < 100 Then
                                    For Each item As Object In ACategorys
                                        Categorys.Add(item)
                                    Next
                                    Exit While
                                Else
                                    For Each item As Object In ACategorys
                                        Categorys.Add(item)
                                    Next
                                    pageNum = (pageNum + 1)
                                End If

                            End While

                        Catch e As Exception
                            Throw New Exception(e.Message)
                        End Try

                        Dim CategoryID
                        Dim SubCategoryID

                        Dim maincatIndex = 0

                        If DoNotUpdateCategories = False Then

                            For Each maincat In MaincategoryList

                                Dim ExistmainCategory = From m In Categorys Where m.name.Equals(MaincategoryList(maincatIndex).Trim()) ', StringComparison.OrdinalIgnoreCase)

                                If (ExistmainCategory.Count() = Nothing) Then
                                    Try

                                        Dim c1 As ProductCategory = New WooCommerceNET.WooCommerce.v3.ProductCategory() With {
                                          .name = MaincategoryList(maincatIndex).Trim()
                                          }
                                        CategoryID = Await wc.Category.Add(c1)

                                    Catch ex As Exception
                                        FileClose(30)
                                        FileOpen(30, D_Drive + "\compu\offline-items-errors.mainCATOGS." & TermNumber, OpenMode.Append, OpenShare.Shared)
                                        WriteLine(30, Now, sku, maincat, ex.Message)
                                        FileClose(30)
                                    End Try
                                Else
                                    CategoryID = ExistmainCategory.FirstOrDefault()
                                End If
                                Try

                                    Dim ProductCategory1 As New WooCommerceNET.WooCommerce.v3.ProductCategoryLine
                                    ProductCategory1.id = CategoryID.id
                                    ProductCategory.Add(ProductCategory1)

                                Catch ex As Exception
                                    '
                                End Try

                                If (maincatIndex = 0) Then
                                    Dim subcatIndex = 0
                                    For Each subcat In subcategoryList

                                        Dim ExistsubCategory = From m In Categorys Where m.name.Equals(subcategoryList(subcatIndex).Trim()) ', StringComparison.OrdinalIgnoreCase)

                                        If (ExistsubCategory.Count() = Nothing) Then

                                            If (Not String.IsNullOrEmpty(subCategory.Trim())) Then
                                                Try

                                                    Dim c2 As ProductCategory = New ProductCategory() With {
                                                  .name = subcategoryList(subcatIndex).Trim(),
                                                  .parent = CategoryID.id
                                                  }
                                                    SubCategoryID = Await wc.Category.Add(c2)

                                                Catch ex As Exception
                                                    FileClose(30)
                                                    FileOpen(30, D_Drive + "\compu\offline-items-errors.subCATOGS." & TermNumber, OpenMode.Append, OpenShare.Shared)
                                                    WriteLine(30, Now, sku, maincat, ex.Message)
                                                    FileClose(30)
                                                End Try
                                            End If

                                        Else
                                            Try
                                                SubCategoryID = ExistsubCategory.FirstOrDefault()

                                                Dim c2 As WooCommerceNET.WooCommerce.v3.ProductCategory = New WooCommerceNET.WooCommerce.v3.ProductCategory() With {
                                              .parent = CategoryID.id
                                              }
                                                Await wc.Category.Update(SubCategoryID.id, c2)

                                            Catch ex As Exception
                                                Throw New Exception(ex.Message)
                                            End Try
                                        End If

                                        If (Not String.IsNullOrEmpty(subCategory.Trim())) Then
                                            Try

                                                Dim ProductCategory2 As New ProductCategoryLine
                                                ProductCategory2.id = SubCategoryID.id
                                                ProductCategory.Add(ProductCategory2)

                                            Catch ex As Exception
                                                '
                                            End Try
                                        End If
                                        subcatIndex = subcatIndex + 1
                                    Next
                                End If

                                maincatIndex = maincatIndex + 1

                            Next


来源: stackexchange

问:
How to discover new services when peripheral change services
Currently, I am facing a case like the following when working with the core bluetooth framework:

The phone will first connect to the bluetooth device and scan for the services the bluetooth device provides. After doing some operations, the bluetooth device will start emitting new services. At this point, I keep rediscovering services, but I'll still only see the old services discovered before but not the new ones. I put the log in the didModifyServices function but I don't see it running here. For android side, they will handle it by clearing the cache of bluetooth services and scanning again. However, when I search on IOS, it doesn't seem to support this operation to clear the cache, and the device side must have to indicate the 2A05 characteristic to let the phone know that the device has changed the service. Since I've never worked with Core Bluetooth framework myself, I don't know if this method really works.

I don't know if anyone here has encountered a similar situation, can you confirm it or give me a way to solve this problem?

ContentLicense: CC BY-SA 4.0


问:
React components flicker with conditional rendering
I have a set of tables being conditionally rendered based off the "view" state (i.e. pending, rejected, etc.). Whenever I swap the conditional the tables have this flickering where you can briefly see the previous table. I have a suspicion based off other issues listed here that this has to do with how I've structured my components. Any help is much appreciated. Here is the code that houses the tables:

```<code>const Admin = React.memo(({ theme }: { theme: string }) => {
  const currentView = useRecoilValue(viewState);
  const data = useRecoilValue<any>(dataState);
  return (
    <div className="w-full h-screen grid grid-cols-8">
      <div className="col-span-1 dark:bg-[#292735] bg-[#F8F6F9]">
        <Sidebar theme={theme} />
      </div>
      <div className="col-span-7 dark:bg-bg-dark-app  bg-[#E5E5E5]">
        <View viewState={currentView} data={currentData}/>
      </div>
    </div>
  );
});

</code>```
```<code>const View = React.memo(({viewState, data}: {viewState: string, data:any}) => {
  return (<div className="px-4 py-4">
<div className="pb-4 text-text-600 dark:text-text-300 font-bold text-lg">
{startCase(viewState)}
</div>
    <div>
  {viewState === 'pending' && <PendingTable data={data}/>}
  {viewState === 'approved' && <ApprovedTable data={data}/>}
  {viewState === 'rejected' && <RejectedTable data={data}/>}
  {viewState === 'completed' && <CompletedTable data={data}/>}

    </div>

  </div>)
})
</code>```
```<code>const ApprovedTable = ({data}: {data: any}) => {
  return (
    <div>
      <VirtualizedTable cols={APPROVE_COLS} data={data} />
    </div>
  );
};
</code>```

I've tried memoization of the parent components, and refactoring to decouple some of the child components. However, none of them seem to have made any difference.

Body:
I have a set of tables being conditionally rendered based off the "view" state (i.e. pending, rejected, etc.). Whenever I swap the conditional the tables have this flickering where you can briefly see the previous table. I have a suspicion based off other issues listed here that this has to do with how I've structured my components. Any help is much appreciated. Here is the code that houses the tables:

const Admin = React.memo(({ theme }: { theme: string }) => {
  const currentView = useRecoilValue(viewState);
  const data = useRecoilValue<any>(dataState);
  return (

        <Sidebar theme={theme} />

        <View viewState={currentView} data={currentData}/>

  );
});

const View = React.memo(({viewState, data}: {viewState: string, data:any}) => {
  return (

{startCase(viewState)}

  {viewState === 'pending' && <PendingTable data={data}/>}
  {viewState === 'approved' && <ApprovedTable data={data}/>}
  {viewState === 'rejected' && <RejectedTable data={data}/>}
  {viewState === 'completed' && <CompletedTable data={data}/>}

)
})

const ApprovedTable = ({data}: {data: any}) => {
  return (

      <VirtualizedTable cols={APPROVE_COLS} data={data} />

  );
};

I've tried memoization of the parent components, and refactoring to decouple some of the child components. However, none of them seem to have made any difference.


问:
'Component' cannot be used as a JSX component
I am trying to start a React application locally but it fails to build, almost all components have the error 'Component' cannot be used as a JSX component

Here is my package.json:

```<code>{
  "name": "MyApp",
  "version": "0.1.0",
  "dependencies": {
    "@c4dwp/googleapi_core_library": "2.6.7",
    "@date-io/date-fns": "^1.3.11",
    "@date-io/moment": "^1.3.11",
    "@emotion/react": "^11.4.1",
    "@emotion/styled": "^11.3.0",
    "@material-ui/core": "^4.5.0",
    "@material-ui/icons": "^4.4.3",
    "@material-ui/lab": "^4.0.0-alpha.30",
    "@material-ui/pickers": "^3.2.7",
    "@material-ui/styles": "4.11.5",
    "@mui/icons-material": "^5.0.3",
    "@mui/material": "^5.0.3",
    "@mui/styled-engine": "^5.0.1",
    "@types/gapi.client.sheets": "^4.0.20201029",
    "@types/jquery": "^3.3.38",
    "@types/react-router-dom": "^5.1.5",
    "@types/reactour": "^1.18.1",
    "apollo-boost": "^0.4.3",
    "apollo-cache-inmemory": "^1.6.2",
    "apollo-client": "^2.6.10",
    "apollo-link": "^1.2.12",
    "apollo-link-context": "^1.0.19",
    "apollo-link-error": "^1.1.11",
    "apollo-link-http": "^1.5.15",
    "axios": "^0.19.0",
    "classnames": "^2.2.6",
    "convert-array-to-csv": "^1.0.9",
    "convert-csv-to-array": "^1.0.3",
    "css-loader": "^3.4.2",
    "csv-file-validator": "^1.7.4",
    "date-fns": "^2.0.0-beta.5",
    "detect-browser-language": "^0.0.2",
    "dexie": "^2.0.4",
    "dotenv-webpack": "^1.7.0",
    "echarts": "^4.6.0",
    "echarts-for-react-typescript": "^1.2.5",
    "env-cmd": "^10.0.1",
    "file-loader": "^5.0.2",
    "formik": "^2.1.4",
    "fs": "^0.0.1-security",
    "gapi-script": "^1.0.1",
    "google-auth-library": "^5.7.0",
    "google-spreadsheet": "^3.1.15",
    "googleapis": "^46.0.0",
    "graphql": "^14.4.2",
    "graphql-tag": "^2.10.1",
    "html-to-image": "^0.1.1",
    "html-webpack-plugin": "^3.2.0",
    "i18next": "^18.0.1",
    "json2csv": "^4.5.4",
    "jwt-decode": "^2.2.0",
    "lodash": "^4.17.15",
    "material-table": "^1.59.0",
    "mini-css-extract-plugin": "^0.9.0",
    "moment": "^2.24.0",
    "moment-timezone": "^0.5.31",
    "nocache": "^2.1.0",
    "objects-to-csv": "^1.3.5",
    "prop-types": "^15.5.0",
    "query-string": "^6.8.3",
    "react": "^17.0.2",
    "react-addons-update": "^15.6.2",
    "react-apollo": "^2.5.8",
    "react-csv": "^2.0.3",
    "react-data-grid": "^7.0.0-canary.16",
    "react-dom": "^17.0.2",
    "react-file-drop": "^0.2.8",
    "react-file-reader": "^1.1.4",
    "react-fileupload": "^2.4.0",
    "react-google-login": "^5.0.5",
    "react-google-picker": "^0.1.0",
    "react-i18next": "^11.0.0",
    "react-intl-translations-manager": "^5.0.3",
    "react-js-pagination": "^3.0.2",
    "react-json-view": "^1.19.1",
    "react-lazyload": "^2.6.5",
    "react-native-google-drive-api-wrapper": "^1.2.0",
    "react-native-google-sign-in": "^1.0.16",
    "react-papaparse": "3.7.2",
    "react-redux": "7.1.0",
    "react-router-dom": "^5.0.1",
    "react-router-redux": "^4.0.8",
    "react-socket-io": "^0.2.5",
    "react-url-query": "^1.5.0",
    "react-user-guide": "^2.0.0",
    "reactour": "^1.18.1",
    "redux": "4.0.3",
    "redux-saga": "^1.1.3",
    "redux-thunk": "^2.3.0",
    "request-promise": "^4.2.4",
    "save-svg-as-png": "^1.4.14",
    "style-loader": "^1.1.3",
    "styled-components": "^4.0.0",
    "three-dots": "^0.2.0",
    "use-react-router": "^1.0.7",
    "use-state-with-callback": "^2.0.3",
    "uuid": "^3.3.3",
    "xlsx": "^0.16.9",
    "yup": "^0.29.1"
  },
  "devDependencies": {
    "@svgr/webpack": "4.3.3",
    "@testing-library/jest-dom": "^5.1.1",
    "@types/classnames": "^2.2.9",
    "@types/dexie": "^1.3.1",
    "@types/dotenv": "^6.1.1",
    "@types/echarts": "^4.1.15",
    "@types/gapi.auth2": "^0.0.51",
    "@types/graphql": "^14.2.3",
    "@types/i18n": "^0.8.6",
    "@types/jest": "24.0.18",
    "@types/json2csv": "^4.5.1",
    "@types/jwt-decode": "^2.2.1",
    "@types/lodash": "^4.14.149",
    "@types/moment": "^2.13.0",
    "@types/node": "12.7.11",
    "@types/query-string": "^6.3.0",
    "@types/react": "^17.0.14",
    "@types/react-csv": "^1.1.1",
    "@types/react-dom": "^17.0.14",
    "@types/react-file-reader-input": "^1.1.4",
    "@types/react-js-pagination": "^3.0.3",
    "@types/react-redux": "^7.1.0",
    "@types/react-router-dom": "^5.1.5",
    "@types/react-router-redux": "^5.0.18",
    "@types/react-table": "^6.8.5",
    "@types/redux": "^3.6.31",
    "@types/request-promise": "^4.1.44",
    "@types/uuid": "^3.4.5",
    "@types/webpack-env": "^1.14.0",
    "@types/why-did-you-update": "^0.0.10",
    "@typescript-eslint/eslint-plugin": "^2.8.0",
    "@typescript-eslint/parser": "^2.8.0",
    "camelcase": "^5.3.1",
    "case-sensitive-paths-webpack-plugin": "2.2.0",
    "dotenv": "8.2.0",
    "dotenv-expand": "5.1.0",
    "enzyme": "^3.11.0",
    "enzyme-adapter-react-16": "^1.15.2",
    "enzyme-to-json": "^3.4.4",
    "eslint": "^6.6.0",
    "eslint-config-react-app": "^5.1.0",
    "eslint-loader": "3.0.2",
    "eslint-plugin-flowtype": "3.13.0",
    "eslint-plugin-import": "2.18.2",
    "eslint-plugin-jsx-a11y": "6.2.3",
    "eslint-plugin-react": "7.16.0",
    "eslint-plugin-react-hooks": "^1.6.1",
    "fake-indexeddb": "^3.0.0",
    "fs-extra": "^8.1.0",
    "gulp": "^4.0.2",
    "gulp-autoprefixer": "^7.0.1",
    "gulp-clean-css": "^4.2.0",
    "gulp-cli": "^2.2.0",
    "gulp-minify-css": "^1.2.4",
    "jest": "^25.1.0",
    "jest-dom": "^4.0.0",
    "jest-environment-jsdom": "^25.1.0",
    "jest-environment-jsdom-global": "^1.2.0",
    "jest-environment-node": "^25.1.0",
    "jest-extended": "^0.11.5",
    "jest-fetch-mock": "^3.0.1",
    "jest-localstorage-mock": "^2.4.0",
    "jest-sinon": "^1.0.2",
    "mocked-env": "^1.3.2",
    "nodemon": "^1.19.4",
    "postcss-flexbugs-fixes": "4.1.0",
    "postcss-loader": "3.0.0",
    "postcss-normalize": "8.0.1",
    "postcss-preset-env": "6.7.0",
    "postcss-safe-parser": "4.0.1",
    "react-app-polyfill": "^1.0.5",
    "react-dev-utils": "^10.0.0",
    "redux-devtools-extension": "^2.13.8",
    "resolve": "1.12.2",
    "resolve-url-loader": "3.1.1",
    "sass-loader": "8.0.0",
    "semver": "6.3.0",
    "start-server-webpack-plugin": "^2.2.5",
    "svg-url-loader": "2.3.2",
    "terser-webpack-plugin": "1.2.3",
    "ts-jest": "^25.2.0",
    "ts-loader": "^8.0.14",
    "ts-pnp": "1.1.5",
    "typescript": "^4.5.4",
    "uglifyjs-webpack-plugin": "^2.2.0",
    "url-loader": "2.3.0",
    "webpack": "^4.41.5",
    "webpack-cli": "^3.3.10",
    "webpack-dev-server": "^3.10.1",
    "webpack-hot-middleware": "^2.25.0",
    "webpack-manifest-plugin": "2.2.0",
    "webpack-merge": "^4.2.2",
    "webpack-node-externals": "^1.7.2",
    "why-did-you-update": "^1.0.6",
    "workbox-webpack-plugin": "4.3.1"
  },
  "resolutions": {
    "@types/react": "17.0.14",
    "@types/react-dom": "17.0.14"
  },
  "overrides": {
    "@types/react": "17.0.14",
    "@types/react-dom": "17.0.14"
  },
  "scripts": {
    "start:dev": "set NODE_OPTIONS=--max-old-space-size=4096&&webpack-dev-server --open --host localhost --config webpack.dev.js",
    "dev": "NODE_OPTIONS='--max-old-space-size=8192' webpack-dev-server --open --host localhost --config webpack.dev.js",
    "dist": "node --max-old-space-size=8192 node_modules/webpack/bin/webpack.js --config webpack.prod.js",
    "start": "node src/server.js",
    "test": "jest",
    "go": "webpack serve"
  },
  "engines": {
    "npm": ">=5",
    "node": ">=12.0.0"
  },
  "eslintConfig": {
    "extends": "react-app"
  },
  "browserslist": {
    "production": [
      ">0.2%",
      "not dead",
      "not op_mini all"
    ],
    "development": [
      "last 1 chrome version",
      "last 1 firefox version",
      "last 1 safari version"
    ]
  }
}
</code>```

tsconfig.json:

```<code>{
  "compilerOptions": {
    "target": "es5",
    "downlevelIteration": true,
    "lib": [
      "dom",
      "dom.iterable",
      "esnext"
    ],
    "allowJs": true,
    "skipLibCheck": true,
    "esModuleInterop": true,
    "allowSyntheticDefaultImports": true,
    "strict": true,
    "forceConsistentCasingInFileNames": true,
    "moduleResolution": "node",
    "resolveJsonModule": true,
    "isolatedModules": true,
    "noEmit": false,
    "outDir": "dist",
    "module": "esnext",
    "sourceMap": true,
    "jsx": "react",
    "strictPropertyInitialization": false,
    "noImplicitAny": false
  },
  "include": [
    "./src/**/**/*.tsx",
    "./src/**/**/*.ts",
    "./public/css"
, "src/components/common/react-csv/src/components/Link.js"  ],
  "exclude": [
    "node_modules",
    "dist",
    "build",
    "test",
    "**/*.spec.ts"
  ]
}
</code>```

The project is sitting in a yarn workspace.

What I have tried:

Adding "resolutions/overrides" to the package.json file as it seems to fix the problem for other people online, but I keep getting the same error for almost all components

Clearing yarn cache, deleting node_modules and package-lock.json, and doing a yarn install all over again.

It seems to be a configuration problem as the project is working well on other machines.

I get the errors when executing yarn start:dev

Help is appreciated as I've been blocked for several days!

Thank you

Body:
I am trying to start a React application locally but it fails to build, almost all components have the error 'Component' cannot be used as a JSX component

Here is my package.json:

{
  "name": "MyApp",
  "version": "0.1.0",
  "dependencies": {
    "@c4dwp/googleapi_core_library": "2.6.7",
    "@date-io/date-fns": "^1.3.11",
    "@date-io/moment": "^1.3.11",
    "@emotion/react": "^11.4.1",
    "@emotion/styled": "^11.3.0",
    "@material-ui/core": "^4.5.0",
    "@material-ui/icons": "^4.4.3",
    "@material-ui/lab": "^4.0.0-alpha.30",
    "@material-ui/pickers": "^3.2.7",
    "@material-ui/styles": "4.11.5",
    "@mui/icons-material": "^5.0.3",
    "@mui/material": "^5.0.3",
    "@mui/styled-engine": "^5.0.1",
    "@types/gapi.client.sheets": "^4.0.20201029",
    "@types/jquery": "^3.3.38",
    "@types/react-router-dom": "^5.1.5",
    "@types/reactour": "^1.18.1",
    "apollo-boost": "^0.4.3",
    "apollo-cache-inmemory": "^1.6.2",
    "apollo-client": "^2.6.10",
    "apollo-link": "^1.2.12",
    "apollo-link-context": "^1.0.19",
    "apollo-link-error": "^1.1.11",
    "apollo-link-http": "^1.5.15",
    "axios": "^0.19.0",
    "classnames": "^2.2.6",
    "convert-array-to-csv": "^1.0.9",
    "convert-csv-to-array": "^1.0.3",
    "css-loader": "^3.4.2",
    "csv-file-validator": "^1.7.4",
    "date-fns": "^2.0.0-beta.5",
    "detect-browser-language": "^0.0.2",
    "dexie": "^2.0.4",
    "dotenv-webpack": "^1.7.0",
    "echarts": "^4.6.0",
    "echarts-for-react-typescript": "^1.2.5",
    "env-cmd": "^10.0.1",
    "file-loader": "^5.0.2",
    "formik": "^2.1.4",
    "fs": "^0.0.1-security",
    "gapi-script": "^1.0.1",
    "google-auth-library": "^5.7.0",
    "google-spreadsheet": "^3.1.15",
    "googleapis": "^46.0.0",
    "graphql": "^14.4.2",
    "graphql-tag": "^2.10.1",
    "html-to-image": "^0.1.1",
    "html-webpack-plugin": "^3.2.0",
    "i18next": "^18.0.1",
    "json2csv": "^4.5.4",
    "jwt-decode": "^2.2.0",
    "lodash": "^4.17.15",
    "material-table": "^1.59.0",
    "mini-css-extract-plugin": "^0.9.0",
    "moment": "^2.24.0",
    "moment-timezone": "^0.5.31",
    "nocache": "^2.1.0",
    "objects-to-csv": "^1.3.5",
    "prop-types": "^15.5.0",
    "query-string": "^6.8.3",
    "react": "^17.0.2",
    "react-addons-update": "^15.6.2",
    "react-apollo": "^2.5.8",
    "react-csv": "^2.0.3",
    "react-data-grid": "^7.0.0-canary.16",
    "react-dom": "^17.0.2",
    "react-file-drop": "^0.2.8",
    "react-file-reader": "^1.1.4",
    "react-fileupload": "^2.4.0",
    "react-google-login": "^5.0.5",
    "react-google-picker": "^0.1.0",
    "react-i18next": "^11.0.0",
    "react-intl-translations-manager": "^5.0.3",
    "react-js-pagination": "^3.0.2",
    "react-json-view": "^1.19.1",
    "react-lazyload": "^2.6.5",
    "react-native-google-drive-api-wrapper": "^1.2.0",
    "react-native-google-sign-in": "^1.0.16",
    "react-papaparse": "3.7.2",
    "react-redux": "7.1.0",
    "react-router-dom": "^5.0.1",
    "react-router-redux": "^4.0.8",
    "react-socket-io": "^0.2.5",
    "react-url-query": "^1.5.0",
    "react-user-guide": "^2.0.0",
    "reactour": "^1.18.1",
    "redux": "4.0.3",
    "redux-saga": "^1.1.3",
    "redux-thunk": "^2.3.0",
    "request-promise": "^4.2.4",
    "save-svg-as-png": "^1.4.14",
    "style-loader": "^1.1.3",
    "styled-components": "^4.0.0",
    "three-dots": "^0.2.0",
    "use-react-router": "^1.0.7",
    "use-state-with-callback": "^2.0.3",
    "uuid": "^3.3.3",
    "xlsx": "^0.16.9",
    "yup": "^0.29.1"
  },
  "devDependencies": {
    "@svgr/webpack": "4.3.3",
    "@testing-library/jest-dom": "^5.1.1",
    "@types/classnames": "^2.2.9",
    "@types/dexie": "^1.3.1",
    "@types/dotenv": "^6.1.1",
    "@types/echarts": "^4.1.15",
    "@types/gapi.auth2": "^0.0.51",
    "@types/graphql": "^14.2.3",
    "@types/i18n": "^0.8.6",
    "@types/jest": "24.0.18",
    "@types/json2csv": "^4.5.1",
    "@types/jwt-decode": "^2.2.1",
    "@types/lodash": "^4.14.149",
    "@types/moment": "^2.13.0",
    "@types/node": "12.7.11",
    "@types/query-string": "^6.3.0",
    "@types/react": "^17.0.14",
    "@types/react-csv": "^1.1.1",
    "@types/react-dom": "^17.0.14",
    "@types/react-file-reader-input": "^1.1.4",
    "@types/react-js-pagination": "^3.0.3",
    "@types/react-redux": "^7.1.0",
    "@types/react-router-dom": "^5.1.5",
    "@types/react-router-redux": "^5.0.18",
    "@types/react-table": "^6.8.5",
    "@types/redux": "^3.6.31",
    "@types/request-promise": "^4.1.44",
    "@types/uuid": "^3.4.5",
    "@types/webpack-env": "^1.14.0",
    "@types/why-did-you-update": "^0.0.10",
    "@typescript-eslint/eslint-plugin": "^2.8.0",
    "@typescript-eslint/parser": "^2.8.0",
    "camelcase": "^5.3.1",
    "case-sensitive-paths-webpack-plugin": "2.2.0",
    "dotenv": "8.2.0",
    "dotenv-expand": "5.1.0",
    "enzyme": "^3.11.0",
    "enzyme-adapter-react-16": "^1.15.2",
    "enzyme-to-json": "^3.4.4",
    "eslint": "^6.6.0",
    "eslint-config-react-app": "^5.1.0",
    "eslint-loader": "3.0.2",
    "eslint-plugin-flowtype": "3.13.0",
    "eslint-plugin-import": "2.18.2",
    "eslint-plugin-jsx-a11y": "6.2.3",
    "eslint-plugin-react": "7.16.0",
    "eslint-plugin-react-hooks": "^1.6.1",
    "fake-indexeddb": "^3.0.0",
    "fs-extra": "^8.1.0",
    "gulp": "^4.0.2",
    "gulp-autoprefixer": "^7.0.1",
    "gulp-clean-css": "^4.2.0",
    "gulp-cli": "^2.2.0",
    "gulp-minify-css": "^1.2.4",
    "jest": "^25.1.0",
    "jest-dom": "^4.0.0",
    "jest-environment-jsdom": "^25.1.0",
    "jest-environment-jsdom-global": "^1.2.0",
    "jest-environment-node": "^25.1.0",
    "jest-extended": "^0.11.5",
    "jest-fetch-mock": "^3.0.1",
    "jest-localstorage-mock": "^2.4.0",
    "jest-sinon": "^1.0.2",
    "mocked-env": "^1.3.2",
    "nodemon": "^1.19.4",
    "postcss-flexbugs-fixes": "4.1.0",
    "postcss-loader": "3.0.0",
    "postcss-normalize": "8.0.1",
    "postcss-preset-env": "6.7.0",
    "postcss-safe-parser": "4.0.1",
    "react-app-polyfill": "^1.0.5",
    "react-dev-utils": "^10.0.0",
    "redux-devtools-extension": "^2.13.8",
    "resolve": "1.12.2",
    "resolve-url-loader": "3.1.1",
    "sass-loader": "8.0.0",
    "semver": "6.3.0",
    "start-server-webpack-plugin": "^2.2.5",
    "svg-url-loader": "2.3.2",
    "terser-webpack-plugin": "1.2.3",
    "ts-jest": "^25.2.0",
    "ts-loader": "^8.0.14",
    "ts-pnp": "1.1.5",
    "typescript": "^4.5.4",
    "uglifyjs-webpack-plugin": "^2.2.0",
    "url-loader": "2.3.0",
    "webpack": "^4.41.5",
    "webpack-cli": "^3.3.10",
    "webpack-dev-server": "^3.10.1",
    "webpack-hot-middleware": "^2.25.0",
    "webpack-manifest-plugin": "2.2.0",
    "webpack-merge": "^4.2.2",
    "webpack-node-externals": "^1.7.2",
    "why-did-you-update": "^1.0.6",
    "workbox-webpack-plugin": "4.3.1"
  },
  "resolutions": {
    "@types/react": "17.0.14",
    "@types/react-dom": "17.0.14"
  },
  "overrides": {
    "@types/react": "17.0.14",
    "@types/react-dom": "17.0.14"
  },
  "scripts": {
    "start:dev": "set NODE_OPTIONS=--max-old-space-size=4096&&webpack-dev-server --open --host localhost --config webpack.dev.js",
    "dev": "NODE_OPTIONS='--max-old-space-size=8192' webpack-dev-server --open --host localhost --config webpack.dev.js",
    "dist": "node --max-old-space-size=8192 node_modules/webpack/bin/webpack.js --config webpack.prod.js",
    "start": "node src/server.js",
    "test": "jest",
    "go": "webpack serve"
  },
  "engines": {
    "npm": ">=5",
    "node": ">=12.0.0"
  },
  "eslintConfig": {
    "extends": "react-app"
  },
  "browserslist": {
    "production": [
      ">0.2%",
      "not dead",
      "not op_mini all"
    ],
    "development": [
      "last 1 chrome version",
      "last 1 firefox version",
      "last 1 safari version"
    ]
  }
}

tsconfig.json:

{
  "compilerOptions": {
    "target": "es5",
    "downlevelIteration": true,
    "lib": [
      "dom",
      "dom.iterable",
      "esnext"
    ],
    "allowJs": true,
    "skipLibCheck": true,
    "esModuleInterop": true,
    "allowSyntheticDefaultImports": true,
    "strict": true,
    "forceConsistentCasingInFileNames": true,
    "moduleResolution": "node",
    "resolveJsonModule": true,
    "isolatedModules": true,
    "noEmit": false,
    "outDir": "dist",
    "module": "esnext",
    "sourceMap": true,
    "jsx": "react",
    "strictPropertyInitialization": false,
    "noImplicitAny": false
  },
  "include": [
    "./src/**/**/*.tsx",
    "./src/**/**/*.ts",
    "./public/css"
, "src/components/common/react-csv/src/components/Link.js"  ],
  "exclude": [
    "node_modules",
    "dist",
    "build",
    "test",
    "**/*.spec.ts"
  ]
}

The project is sitting in a yarn workspace.

What I have tried:

Adding "resolutions/overrides" to the package.json file as it seems to fix the problem for other people online, but I keep getting the same error for almost all components

Clearing yarn cache, deleting node_modules and package-lock.json, and doing a yarn install all over again.

It seems to be a configuration problem as the project is working well on other machines.

I get the errors when executing yarn start:dev

Help is appreciated as I've been blocked for several days!

Thank you


问:
I cannot use dns records when connecting to msk brokers
I am new to MSK on aws and trying to setup my environment.

I created the brokers and all is working well.

I want to use my own dns records for my clients to connect to but when I do that I get SSL HANDSHAKE error.

I found an article that solved it but it does not seems to work since my clients are not running on aws.
https://aws.amazon.com/blogs/big-data/secure-connectivity-patterns-to-access-amazon-msk-across-aws-regions/

Any help would be appreciated.


问:
Vuetify 3 doesn't pass data-attributes down to the input
I'm trying to use "v-maska" along with "vuetify 3" and have faced the issue.

```<code><v-text-field
  v-for="field in fields"
  name="foo"
  label="Bar"
  v-maska
  data-maska="##-##"
  data-fizz="buzz"
  v-model="field.value"
/>
</code>```

Vuetify doesn't pass the "data-maska" attribute down to the  element keeping the "data-maska" attribute in the "v-input" div.

Same fairs for any other data-* attribute. So I'm assuming that it's not just v-maska related issue but how vuetify passes down the attributes excluding data-*.

Does anyone know with a workaround or the proper way to do that?

Body:
I'm trying to use "v-maska" along with "vuetify 3" and have faced the issue.

<v-text-field
  v-for="field in fields"
  name="foo"
  label="Bar"
  v-maska
  data-maska="##-##"
  data-fizz="buzz"
  v-model="field.value"
/>

Vuetify doesn't pass the "data-maska" attribute down to the  element keeping the "data-maska" attribute in the "v-input" div.

Same fairs for any other data-* attribute. So I'm assuming that it's not just v-maska related issue but how vuetify passes down the attributes excluding data-*.

Does anyone know with a workaround or the proper way to do that?


问:
Vue 3 okta-vue auth
I'm migrating Vue2 to Vue3 and fix a lot of errors.
This error made me to stuck at the progress of migrating and I'm actually need help.

The Error:
enter image description here
While searching in google I have found that lines of code did the error:
enter image description here

And after understand why actually this happened, I recognized that plugin cannot compiled with Vue 3, but I really don't know how to solve this

Plugin:
enter image description here

Someone know how to migrate this part to Vue 3 syntax? or maybe someone know this error and can tell me what to do next?

Title: Vue 3 okta-vue auth


问:
Value does not live long enough even when it is declared outside of the function
Within my cd function, I want to retrieve an element out of a HashMap and assign this reference to cursor.

The rust compiler complains that the reference that I retrieve out of the hashmap does not live long enough. Is that due to my declared live times? I thought that in this scenario I can declare data as 'static, but apparently, structs are not supposed to be static.

This is a smaller reproduction of my code:

```<code>use std::{
    collections::HashMap,
    sync::{Mutex, MutexGuard},
};

#[derive(Debug)]
struct DataEntry {
    name: String,
}

type DataCollection = HashMap<String, DataEntry>;
fn main() {
    let data: Mutex<HashMap<String, DataEntry>> = Mutex::new(DataCollection::new());
    let input = "
      cd /
      ls
      dir d
      dir e
      dir o
    ";
    let lines: Vec<Vec<&str>> = input
        .lines()
        .map(|line| line.trim().split(" ").collect::<Vec<&str>>())
        .collect();
    let cursor: Option<&DataEntry> = None;

    for segments in lines {
        match segments[0] {
            "cd" => {
                let data = data.lock().unwrap();
                cd(segments[1].to_owned(), data, cursor);
            }
            "dir" => {}
            _ => {}
        }
    }
}

fn cd<'a, 'b>(
    name: String,
    mut data: MutexGuard<'a, DataCollection>,
    mut cursor: Option<&'a DataEntry>,
) {
    cursor = Some(
        data.entry(name.clone())
            .or_insert(DataEntry { name: name.clone() }),
    );
}

</code>```

Error:

```<code>error[E0597]: `data` does not live long enough
  --> src/bin/test2.rs:45:9
   |
39 | fn cd<'a, 'b>(
   |       -- lifetime `'a` defined here
...
45 |         data.entry(name.clone())
   |         ^^^^^^^^^^^^^^^^^^^^^^^^
   |         |
   |         borrowed value does not live long enough
   |         argument requires that `data` is borrowed for `'a`
...
48 | }
   | - `data` dropped here while still borrowed

</code>```

Body:
Within my cd function, I want to retrieve an element out of a HashMap and assign this reference to cursor.

The rust compiler complains that the reference that I retrieve out of the hashmap does not live long enough. Is that due to my declared live times? I thought that in this scenario I can declare data as 'static, but apparently, structs are not supposed to be static.

This is a smaller reproduction of my code:

use std::{
    collections::HashMap,
    sync::{Mutex, MutexGuard},
};

#[derive(Debug)]
struct DataEntry {
    name: String,
}

type DataCollection = HashMap<String, DataEntry>;
fn main() {
    let data: Mutex<HashMap<String, DataEntry>> = Mutex::new(DataCollection::new());
    let input = "
      cd /
      ls
      dir d
      dir e
      dir o
    ";
    let lines: Vec<Vec<&str>> = input
        .lines()
        .map(|line| line.trim().split(" ").collect::<Vec<&str>>())
        .collect();
    let cursor: Option<&DataEntry> = None;

    for segments in lines {
        match segments[0] {
            "cd" => {
                let data = data.lock().unwrap();
                cd(segments[1].to_owned(), data, cursor);
            }
            "dir" => {}
            _ => {}
        }
    }
}

fn cd<'a, 'b>(
    name: String,
    mut data: MutexGuard<'a, DataCollection>,
    mut cursor: Option<&'a DataEntry>,
) {
    cursor = Some(
        data.entry(name.clone())
            .or_insert(DataEntry { name: name.clone() }),
    );
}

Error:

error[E0597]: `data` does not live long enough
  --> src/bin/test2.rs:45:9
   |
39 | fn cd<'a, 'b>(
   |       -- lifetime `'a` defined here
...
45 |         data.entry(name.clone())
   |         ^^^^^^^^^^^^^^^^^^^^^^^^
   |         |
   |         borrowed value does not live long enough
   |         argument requires that `data` is borrowed for `'a`
...
48 | }
   | - `data` dropped here while still borrowed


问:
How do I bind my swipeview item properly to my command in ViewModel
I'm trying to bind my Swipeview delete item to my DeleteBook method. When I press the button nothing happens so there is most likely something wrong with the binding. I tried changing bindingcontext.deletebook to bindingcontext.deletebookcommand and not having the 'bindingcontext.deletebook' part.

My Xaml

```<code>     xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
     xmlns:models="clr-namespace:eBooks.Models"
     xmlns:effectsView="clr-namespace:Syncfusion.Maui.Core;assembly=Syncfusion.Maui.Core"
     x:Class="eBooks.Library"
     xmlns:viewmodel="clr-namespace:eBooks.ViewModel"
     Title="Bibliotheek">
<ContentPage.BindingContext>
    <viewmodel:LibraryViewModel />
</ContentPage.BindingContext>

<Grid>
    <Grid.RowDefinitions>
        <RowDefinition Height="auto"></RowDefinition>
        <RowDefinition Height="*"></RowDefinition>
    </Grid.RowDefinitions>

    <Button
            x:Name="addBookButton"
            Grid.Row="0"
            Background="White"
            TextColor="Black"
            Text="Voeg een boek toe"
            Clicked="AddBookButton_Clicked"
            Margin="0, 20, 0, 0"
            HeightRequest="44"
            WidthRequest="300">
        <Button.Shadow>
            <Shadow Brush="White" Radius="15" Opacity="0.8" />
        </Button.Shadow>
    </Button>

    <CollectionView ItemsSource="{Binding Books}" Margin="36,20,36,20" Grid.Row="1">
        <CollectionView.ItemTemplate>
            <DataTemplate>
                <SwipeView Margin="0, 5, 10, 0">
                    <SwipeView.RightItems>
                        <SwipeItem
                            x:Name="deleteButton"
                            Text="Delete"
                            IconImageSource="delete.png"
                            BackgroundColor="{StaticResource Gray950}"
                            Command="{Binding BindingContext.DeleteBook,Source={RelativeSource AncestorType={x:Type viewmodel:LibraryViewModel}}}"
                            CommandParameter="{Binding Id}" />
                    </SwipeView.RightItems>
                    <Border StrokeThickness="3">
                        <Border.Stroke>
                            <LinearGradientBrush EndPoint="0,1">
                                <GradientStop Color="White" Offset="0.1" />
                                <GradientStop Color="{StaticResource Gray950}" Offset="1.0" />
                            </LinearGradientBrush>
                        </Border.Stroke>
                        <effectsView:SfEffectsView ScaleFactor="1.15" LongPressEffects="Highlight">
                            <Grid HeightRequest="84" BackgroundColor="Black">
                                <Image Aspect="AspectFill" Source="{Binding ThumbnailSource}" Opacity="0.38"/>
                                <Label FontSize="18" TextColor="White" Text="{Binding Title}" FontAttributes="Bold" Margin="32, 24, 0, 0"/>
                                <ProgressBar WidthRequest="250" Margin="0, 46, 0, 0" ProgressColor="White" Progress="{Binding Progress}"/>
                            </Grid>
                        </effectsView:SfEffectsView>
                    </Border>
                </SwipeView>
            </DataTemplate>
        </CollectionView.ItemTemplate>
    </CollectionView>
</Grid>
</code>```

My ViewModel

```<code>namespace eBooks.ViewModel
{
    public partial class LibraryViewModel : ObservableObject
    {
        readonly BookService bookService = new();
        public LibraryViewModel()
        {
            using var db = new BooksContext();
            db.RemoveRange(db.Books);
            db.SaveChanges();
            BookService.OnBooksChanged += RefreshLibrary;
            RefreshLibrary();
        }

        public void RefreshLibrary(List<Book> books = null)
        {
            using var db = new BooksContext();
            Books = new ObservableCollection<Book>(db.Books);
        }

        [ObservableProperty]
        ObservableCollection<Book> _books;

        [RelayCommand]
        public void DeleteBook(int id) => bookService.Delete(id);
    }
}
</code>```

Body:
I'm trying to bind my Swipeview delete item to my DeleteBook method. When I press the button nothing happens so there is most likely something wrong with the binding. I tried changing bindingcontext.deletebook to bindingcontext.deletebookcommand and not having the 'bindingcontext.deletebook' part.

My Xaml

     xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
     xmlns:models="clr-namespace:eBooks.Models"
     xmlns:effectsView="clr-namespace:Syncfusion.Maui.Core;assembly=Syncfusion.Maui.Core"
     x:Class="eBooks.Library"
     xmlns:viewmodel="clr-namespace:eBooks.ViewModel"
     Title="Bibliotheek">
<ContentPage.BindingContext>
    <viewmodel:LibraryViewModel />
</ContentPage.BindingContext>

<Grid>
    <Grid.RowDefinitions>
        <RowDefinition Height="auto"></RowDefinition>
        <RowDefinition Height="*"></RowDefinition>
    </Grid.RowDefinitions>

    <Button
            x:Name="addBookButton"
            Grid.Row="0"
            Background="White"
            TextColor="Black"
            Text="Voeg een boek toe"
            Clicked="AddBookButton_Clicked"
            Margin="0, 20, 0, 0"
            HeightRequest="44"
            WidthRequest="300">
        <Button.Shadow>
            <Shadow Brush="White" Radius="15" Opacity="0.8" />
        </Button.Shadow>
    </Button>

    <CollectionView ItemsSource="{Binding Books}" Margin="36,20,36,20" Grid.Row="1">
        <CollectionView.ItemTemplate>
            <DataTemplate>
                <SwipeView Margin="0, 5, 10, 0">
                    <SwipeView.RightItems>
                        <SwipeItem
                            x:Name="deleteButton"
                            Text="Delete"
                            IconImageSource="delete.png"
                            BackgroundColor="{StaticResource Gray950}"
                            Command="{Binding BindingContext.DeleteBook,Source={RelativeSource AncestorType={x:Type viewmodel:LibraryViewModel}}}"
                            CommandParameter="{Binding Id}" />
                    </SwipeView.RightItems>
                    <Border StrokeThickness="3">
                        <Border.Stroke>
                            <LinearGradientBrush EndPoint="0,1">
                                <GradientStop Color="White" Offset="0.1" />
                                <GradientStop Color="{StaticResource Gray950}" Offset="1.0" />
                            </LinearGradientBrush>
                        </Border.Stroke>
                        <effectsView:SfEffectsView ScaleFactor="1.15" LongPressEffects="Highlight">
                            <Grid HeightRequest="84" BackgroundColor="Black">
                                <Image Aspect="AspectFill" Source="{Binding ThumbnailSource}" Opacity="0.38"/>

                                <ProgressBar WidthRequest="250" Margin="0, 46, 0, 0" ProgressColor="White" Progress="{Binding Progress}"/>
                            </Grid>
                        </effectsView:SfEffectsView>
                    </Border>
                </SwipeView>
            </DataTemplate>
        </CollectionView.ItemTemplate>
    </CollectionView>
</Grid>

My ViewModel

namespace eBooks.ViewModel
{
    public partial class LibraryViewModel : ObservableObject
    {
        readonly BookService bookService = new();
        public LibraryViewModel()
        {
            using var db = new BooksContext();
            db.RemoveRange(db.Books);
            db.SaveChanges();
            BookService.OnBooksChanged += RefreshLibrary;
            RefreshLibrary();
        }

        public void RefreshLibrary(List<Book> books = null)
        {
            using var db = new BooksContext();
            Books = new ObservableCollection<Book>(db.Books);
        }

        [ObservableProperty]
        ObservableCollection<Book> _books;

        [RelayCommand]
        public void DeleteBook(int id) => bookService.Delete(id);
    }
}


问:
Using Count Average and median in SQL case when statement
I am trying to create a query where if the student id count is 2, then the output should be the average score of those two.
If the student id count is more than 2, then the output should be the median score of those students. I'm not getting the desired output

Here is the case-when statement that I am using:

```<code>case when (count(Student.STUDENT_ID) = 2) THEN AVG(Scores.TEST_GROWTH_PERCENTILE)
    else PERCENTILE_DISC(0.5) WITHIN GROUP (ORDER BY TEST_GROWTH_PERCENTILE) OVER (PARTITION BY dates.local_school_year,grade.domain_decode)
   END
</code>```

Body:
I am trying to create a query where if the student id count is 2, then the output should be the average score of those two.
If the student id count is more than 2, then the output should be the median score of those students. I'm not getting the desired output

Here is the case-when statement that I am using:

case when (count(Student.STUDENT_ID) = 2) THEN AVG(Scores.TEST_GROWTH_PERCENTILE)
    else PERCENTILE_DISC(0.5) WITHIN GROUP (ORDER BY TEST_GROWTH_PERCENTILE) OVER (PARTITION BY dates.local_school_year,grade.domain_decode)
   END


问:
How to make a streamlit-echarts graph responsive?
As a beginner in streamlit-echarts components, I have a question: Can we create a responsive graph with st_echarts?
I know we can use fractional values(100% etc.) for the heigth & width arguments but it did not help to resize the graphs in the smaller screens. What can I do to make st_echart graphics responsive?
Thanks in advance.

Below code is an example for a pie chart that I used that I hope gives an idea, unfortunately I cannot share the data due to being work-related.
Code snippet:

```<code>pie1, pie2 = st.columns(2)

with pie1:
    options_yonelik = {
        "legend": {"top": "top"},
        "tooltip": {"trigger": "item", "formatter": "{a} <br/>{b}: {c} ({d}%)"},
        "textStyle": {
            "fontFamily": "'Poppins', sans-serif",
            "fontWeight": 400,
            "fontSize": 18,
        },
        "series": [
            {
                "name": "Kimlere Yönelik Çalışır",
                "type": "pie",
                "radius": [80, 200],
                "center": ["50%", "50%"],
                "roseType": "area",
                "label": {
                    "rotate": 0,
                    "width": 200,
                    "fontFamily": "'Poppins', sans-serif",
                    "fontWeight": 400,
                    "fontSize": 15,
                },
                "labelLayout": {"draggable": True},
                "itemStyle": {"borderRadius": 8},
                "color": ["#ff9898", "#af98ff", "#ffd998"],
                "data": [
                    {"value": round(val, 2), "name": name}
                    for name, val in data.loc[:, "İlgili Giriş Noktası"]
                    .value_counts()[:3]
                    .to_dict()
                    .items()
                ],
            }
        ],
    }
    st_echarts(options_yonelik, height="600px", width="100%")
</code>```

Note: using height = "100%" clips the graph into 150*200px iframe.
Expected behavior:

for the graph to be resized (not cut) for different sized screens

Actual behavior:
iframe gets smaller but graph does not, therefore the graph got cut.(cannot share pics due to low reputation)

Versions

Streamlit version: (1.15.1)

Python version: (3.11.0)

Body:
As a beginner in streamlit-echarts components, I have a question: Can we create a responsive graph with st_echarts?
I know we can use fractional values(100% etc.) for the heigth & width arguments but it did not help to resize the graphs in the smaller screens. What can I do to make st_echart graphics responsive?
Thanks in advance.

Below code is an example for a pie chart that I used that I hope gives an idea, unfortunately I cannot share the data due to being work-related.
Code snippet:

pie1, pie2 = st.columns(2)

with pie1:
    options_yonelik = {
        "legend": {"top": "top"},
        "tooltip": {"trigger": "item", "formatter": "{a}
{b}: {c} ({d}%)"},
        "textStyle": {
            "fontFamily": "'Poppins', sans-serif",
            "fontWeight": 400,
            "fontSize": 18,
        },
        "series": [
            {
                "name": "Kimlere Yönelik Çalışır",
                "type": "pie",
                "radius": [80, 200],
                "center": ["50%", "50%"],
                "roseType": "area",
                "label": {
                    "rotate": 0,
                    "width": 200,
                    "fontFamily": "'Poppins', sans-serif",
                    "fontWeight": 400,
                    "fontSize": 15,
                },
                "labelLayout": {"draggable": True},
                "itemStyle": {"borderRadius": 8},
                "color": ["#ff9898", "#af98ff", "#ffd998"],
                "data": [
                    {"value": round(val, 2), "name": name}
                    for name, val in data.loc[:, "İlgili Giriş Noktası"]
                    .value_counts()[:3]
                    .to_dict()
                    .items()
                ],
            }
        ],
    }
    st_echarts(options_yonelik, height="600px", width="100%")

Note: using height = "100%" clips the graph into 150*200px iframe.
Expected behavior:

for the graph to be resized (not cut) for different sized screens

Actual behavior:
iframe gets smaller but graph does not, therefore the graph got cut.(cannot share pics due to low reputation)

Versions

Streamlit version: (1.15.1)

Python version: (3.11.0)


问:
Trying to connect to Sentry ver 1.7.30 with Spring Boot ver 1.5.7
Hi I am getting confused with setting up old version of Sentry(ver 1.7.30) with current Spring Boot project(ver 1.5.7).

Here's my part of Gradle:

```<code>dependencies {
    compile("org.springframework.boot:spring-boot-starter-web")
    compile("org.springframework.boot:spring-boot-starter-logging")
    compile("org.springframework.boot:spring-boot-starter-actuator")

    ...

    implementation 'io.sentry:sentry-spring:1.7.30'
    implementation 'io.sentry:sentry-logback:1.7.30'
}
</code>```

application-local.yml

```<code>sentry:
  dsn: https://dsnPath
</code>```

logback-spring.xml

```<code><?xml version="1.0" encoding="UTF-8"?>

<!-- sentry -->
<configuration>
  <appender name="Sentry" class="io.sentry.logback.SentryAppender">
    <filter class="ch.qos.logback.classic.filter.ThresholdFilter">
      <level>WARN</level>
    </filter>
    <encoder>
      <pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern>
    </encoder>
  </appender>

  <root level="info">
    <appender-ref ref="FILE"/>
    <appender-ref ref="Sentry" />
  </root>
</configuration>
</code>```

When I run the project on local laptop, I can see some exception logs on console but they don't show up on Sentry. One thing I'm sure is..there's log4j2-spring.xml before I created logback-spring.xml file only for Sentry and this might be a problem?

(I followed the instruction on official page - https://docs.sentry.io/platforms/java/legacy/spring/ - and it didn't work. Maybe I made mistake regarding resolver.)

Thanks in advance!

Body:
Hi I am getting confused with setting up old version of Sentry(ver 1.7.30) with current Spring Boot project(ver 1.5.7).

Here's my part of Gradle:

dependencies {
    compile("org.springframework.boot:spring-boot-starter-web")
    compile("org.springframework.boot:spring-boot-starter-logging")
    compile("org.springframework.boot:spring-boot-starter-actuator")

    ...

    implementation 'io.sentry:sentry-spring:1.7.30'
    implementation 'io.sentry:sentry-logback:1.7.30'
}

application-local.yml

sentry:
  dsn: https://dsnPath

logback-spring.xml

<?xml version="1.0" encoding="UTF-8"?>

<configuration>
  <appender name="Sentry" class="io.sentry.logback.SentryAppender">
    <filter class="ch.qos.logback.classic.filter.ThresholdFilter">
      <level>WARN</level>
    </filter>
    <encoder>
      <pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern>
    </encoder>
  </appender>

  <root level="info">
    <appender-ref ref="FILE"/>
    <appender-ref ref="Sentry" />
  </root>
</configuration>

When I run the project on local laptop, I can see some exception logs on console but they don't show up on Sentry. One thing I'm sure is..there's log4j2-spring.xml before I created logback-spring.xml file only for Sentry and this might be a problem?

(I followed the instruction on official page - https://docs.sentry.io/platforms/java/legacy/spring/ - and it didn't work. Maybe I made mistake regarding resolver.)

Thanks in advance!


问:
Where is the Http Status Code generated using Asp.net - Global.asax - Hosted by IIS
This is my first Question on Stack.
I have created a dynamic routing table:

```<code> Sub Application_Start(ByVal sender As Object, ByVal e As EventArgs)
        ' Fires when the application is started
        Dim RouteConfig As New Cls_Menues
        RouteConfig.RegisterRoutes(RouteTable.Routes)
        Dim RR As New Cls_Menues
        url_table = RR.CreateUrls_dt()

    End Sub
</code>```

I am using the Friendly URL Reference in VS Studio 2019.
I simply want to check the request (example: https://localhost:44310/WWW-Sysyems) and look it up in the url_table then use my Home.aspx webform file to generate a responce.

Url_table:
NoneID: URL:                           FriendlyUrl:
95  /Home                          /Home
129 /WWW Sysyems                   /WWW-Sysyems
128 /Cloud Computing/Security      /Cloud-Computing/Security
etc...

What and where should I program this in my Global.asax file???
Thank You - Ken

HTTP Error 404.0 - Not Found
The resource you are looking for has been removed, had its name changed, or is temporarily unavailable.

Body:
This is my first Question on Stack.
I have created a dynamic routing table:

 Sub Application_Start(ByVal sender As Object, ByVal e As EventArgs)
        ' Fires when the application is started
        Dim RouteConfig As New Cls_Menues
        RouteConfig.RegisterRoutes(RouteTable.Routes)
        Dim RR As New Cls_Menues
        url_table = RR.CreateUrls_dt()

    End Sub

I am using the Friendly URL Reference in VS Studio 2019.
I simply want to check the request (example: https://localhost:44310/WWW-Sysyems) and look it up in the url_table then use my Home.aspx webform file to generate a responce.

Url_table:
NoneID: URL:                           FriendlyUrl:
95  /Home                          /Home
129 /WWW Sysyems                   /WWW-Sysyems
128 /Cloud Computing/Security      /Cloud-Computing/Security
etc...

What and where should I program this in my Global.asax file???
Thank You - Ken

HTTP Error 404.0 - Not Found
The resource you are looking for has been removed, had its name changed, or is temporarily unavailable.


问:
How can I calibrate the Random Forest better?
to predict the turnover possibility of individual employees. I found that Random Forest made the best performance. After that I really want to use predict_proba to assess the probability of turnover from individuals. Before that, I was trying to calibrate my Random Forest with Isotonic Calibration. But the output from calibration is as below. Is there any issue with my approach?

```<code>def uncalibrated(model):
    return model.predict_proba(X_test)[:, 1]

def calibrated(model):
    calibrated = CalibratedClassifierCV(model, method='isotonic')
    calibrated.fit(X_train, y_train)
    # predict probabilities
    return calibrated.predict_proba(X_test)[:, 1]

# uncalibrated predictions
yhat_uncalibrated = uncalibrated(rf_clf)

# calibrated predictions
yhat_calibrated = calibrated(rf_clf)

# reliability diagrams
fop_uncalibrated, mpv_uncalibrated = calibration_curve(y_test, yhat_uncalibrated, n_bins=10)
fop_calibrated, mpv_calibrated = calibration_curve(y_test, yhat_calibrated, n_bins=10)

# plot perfectly calibrated
pyplot.plot([0, 1], [0, 1], linestyle='--', color='black')

# plot model reliabilities
pyplot.plot(mpv_uncalibrated, fop_uncalibrated, marker='.', label='Random Forest')
pyplot.plot(mpv_calibrated, fop_calibrated, marker='.', label='Isotonic Calibration')
plt.xlabel('Fraction belonging to positive class')
plt.ylabel('Predicted probability of positive class')
pyplot.legend()
pyplot.show()
</code>```

```<code>from sklearn.metrics import brier_score_loss
clf_score = brier_score_loss(y_test, uncalibrated(rf_clf))
print("No calibration: %1.3f" % clf_score)

clf_isotonic_score = brier_score_loss(y_test, calibrated(rf_clf))
print("With isotonic calibration: %1.3f" % clf_isotonic_score)
</code>```

No calibration: 0.049
With isotonic calibration: 0.045

Body:
to predict the turnover possibility of individual employees. I found that Random Forest made the best performance. After that I really want to use predict_proba to assess the probability of turnover from individuals. Before that, I was trying to calibrate my Random Forest with Isotonic Calibration. But the output from calibration is as below. Is there any issue with my approach?

def uncalibrated(model):
    return model.predict_proba(X_test)[:, 1]

def calibrated(model):
    calibrated = CalibratedClassifierCV(model, method='isotonic')
    calibrated.fit(X_train, y_train)
    # predict probabilities
    return calibrated.predict_proba(X_test)[:, 1]

# uncalibrated predictions
yhat_uncalibrated = uncalibrated(rf_clf)

# calibrated predictions
yhat_calibrated = calibrated(rf_clf)

# reliability diagrams
fop_uncalibrated, mpv_uncalibrated = calibration_curve(y_test, yhat_uncalibrated, n_bins=10)
fop_calibrated, mpv_calibrated = calibration_curve(y_test, yhat_calibrated, n_bins=10)

# plot perfectly calibrated
pyplot.plot([0, 1], [0, 1], linestyle='--', color='black')

# plot model reliabilities
pyplot.plot(mpv_uncalibrated, fop_uncalibrated, marker='.', label='Random Forest')
pyplot.plot(mpv_calibrated, fop_calibrated, marker='.', label='Isotonic Calibration')
plt.xlabel('Fraction belonging to positive class')
plt.ylabel('Predicted probability of positive class')
pyplot.legend()
pyplot.show()

from sklearn.metrics import brier_score_loss
clf_score = brier_score_loss(y_test, uncalibrated(rf_clf))
print("No calibration: %1.3f" % clf_score)

clf_isotonic_score = brier_score_loss(y_test, calibrated(rf_clf))
print("With isotonic calibration: %1.3f" % clf_isotonic_score)

No calibration: 0.049
With isotonic calibration: 0.045


问:
useState() erases an array that I don't even touch
My problem is that after changing sets, react nullifies the array by itself.
My code will check how many elements there are in the "sa" array and some value displays the one I need in the console, but when I wrote a variable change through useState (), the script erases my "sa" array after the conditions are met. In short, it works well with the console, but when I change the variable, it erases the array for me.
The problem is almost at the end of the script, where the loop for(let z of sa)

```<code>import { useEffect, useState, useRef } from 'react';
import './App.css';

function App() {
    // let map = new Map()
  //Функции
  function exit(){
    alert('Выйти')
  }

  let [music_stat, set_music_stat] = useState(1)
  function music(){
    if(music_stat){
      alert('Выключить звук')
      set_music_stat(music_stat = 0)
    }else{
      alert('Включить звук')
      set_music_stat(music_stat = 1)
    }
  }

  let [cubs, setcubs] = useState([
    {id:1,title:1, img:"https://www.zonkpro.ru/zonk/assets/dice/mini/1.png"},
    {id:2,title:2, img:"https://www.zonkpro.ru/zonk/assets/dice/mini/2.png"},
    {id:3,title:3, img:"https://www.zonkpro.ru/zonk/assets/dice/mini/3.png"},
    {id:4,title:4, img:"https://www.zonkpro.ru/zonk/assets/dice/mini/4.png"},
    {id:5,title:5, img:"https://www.zonkpro.ru/zonk/assets/dice/mini/5.png"},
    {id:6,title:6, img:"https://www.zonkpro.ru/zonk/assets/dice/mini/6.png"},
  ])

  let [raundco, setraundco] = useState(0)
  let [debcount, setdebcount] = useState(0)
  let [raund, setraund] = useState([
    {id:0, counter:0},
    {id:1, counter:0},
    {id:2, counter:0},
    {id:3, counter:0},
    {id:4, counter:0},
    {id:5, counter:0},
    {id:6, counter:0},
    {id:7, counter:0},
    {id:8, counter:0},
    {id:9, counter:0},
  ])

let [stroka,setstroka] = useState(6)

  let [cubikinapole, setcubikinapole] = useState([

  ])

  let list = []
  function sheker(){
    for(let i=0;i<6;i++){
      let randomcub = Math.floor(Math.random() * (6 - 0) + 0)
      let obj = {
        id: Date.now() + Math.random(),
        title: cubs[3].title,
        img: cubs[3].img
      }
      list.push(obj)
    }
    setcubikinapole([...cubikinapole, ...list])
    posa()
  }

  let map = new Map()

  function posa(){
          for(let key of list){
            if(map.has(key.title) == false){
                map.set(key.title, 1)
            }
            else{
                map.set(key.title, map.get(key.title)+1)
            }
        }
  }
    function save(){
        if(debcount <300){
            console.log('Вы не можете сохранить')
        }else{
            console.log('вы можете сохранить')
            setraund([...raund, raund[raundco].counter += debcount])
            // setraund(raund.at())
            // setraund([...raund[raundco], raund[raundco].counter += debcount])
            setraundco(raundco = raundco + 1)
            setdebcount(debcount = 0)
            setcubikinapole(cubikinapole = [])
            list = []
            map = []

        }
    }
    function deletea(){
        list = []
        map = []
        setcubikinapole(cubikinapole = [])
        console.log(list)
        console.log(cubikinapole)
        console.log(map)

    }
    // for(let key of cubikinapole){
        //     if(sa.has(key.title) == false){
            //         sa.set(key.title, 1)
            //     }
            //     else{
                //         sa.set(key.title, sa.get(key.title)+1)
                //     }
                // }
    let sa = new Map()
    let com3 = Object.fromEntries([
        [1,2], [3,2] , [6,2]
    ])
    let com4 = Object.fromEntries([
        [1,1],[2,1],[3,1],[4,1],[5,1],[6,1]
    ])
    let com1 = Object.fromEntries([
        [1,1]
    ])
    let com6 = Object.fromEntries([
        [4,3]
    ])

    function a(el){
            if(sa.has(el.title) == false){
                sa.set(el.title, 1)
                console.log('net new')
            }
            else{
                sa.set(el.title, sa.get(el.title)+1)
                console.log('est')
            }

        //Проверяем комбинацию 3пары
        if(JSON.stringify(com3) == JSON.stringify(Object.fromEntries(sa))){
            setdebcount(debcount+=750)
            console.log('3пары + 750очков')
            // setcubikinapole(cubikinapole = [])
            // list = []
            // map = []
            // sa= []
        }
        //Проверяем комбинацию стрит
        if(JSON.stringify(com4) == JSON.stringify(Object.fromEntries(sa))){
            setdebcount(debcount+=1500)
            console.log('Стрит! + 1500очков')
            // setcubikinapole(cubikinapole = [])
            // list = []
            // map = []
            // sa= []
        }

        //
        for(let z of sa){
            if(z[0] == el.title){
                if(z[1]==3){
                    console.log(z[0] + '00')
                    // setdebcount(debcount+= Number(z[0] + '00'))
                }else if(z[1] < 3){
                    console.log('Ничего')
                }
                else{
                    console.log(z[0]*2+'00')
                    // setdebcount(debcount+= Number(z[0] * 2 + '00'))
                }
            }
            console.log(z)
        }

        }

  return (
    <div className="App">
     <div className="container" id='test'>
        <div className="header">
            <button onClick={()=>exit}>Выйти</button>
            <button onClick={()=>music}>Выключить звук</button>
        </div>
        <div className="main">
            <div className="counter">
                <div className="name">
                    <img src="https://miro.medium.com/max/1200/1*Xy0Iv7mQEg-5LpmJxUarVw.jpeg" alt="" />
                    <h2>JavaScript/React Js</h2>
                    <h3>Debug counter: {debcount}</h3>
                </div>
                <div className="counters">
                    <ul>
                    {raund.map(el=>
                        <li key={el.id}>{el.id + 1 +'. '+ el.counter}</li>
                        )}
                    </ul>
                    <h2>Общий счет</h2>
                    <button onClick={()=>save()}>Сохранить</button>
                    <button onClick={()=>deletea()}>Очистить поле</button>
                </div>
            </div>
            <div className="pole">
                <div className="ymnojitli">
                    <div className="z g">Z</div>
                    <div className="-z g">-Z</div>
                    <div className="x2 g">X2</div>
                    <div className="6 g">+6</div>
                </div>
                <div className="samo_pole">
                  <div className='cubiki'>
                    {cubikinapole.length !== 0 ?
                    cubikinapole.map((el)=>
                    <div id='cub' key={el.id} className={el.title} onClick={()=>a(el)}>
                      <img src={el.img} />
                    </div>
                    )
                    : console.log() }
                  </div>
                    <div className="sheker">
                        <img src="https://www.zonkpro.ru/zonk/assets/shakers/1.png" alt="" onClick={()=>sheker()}/>
                    </div>
                    <div className="polyakakieto">
                        <div className="blocksone">
                            <div className="blockone all"></div>
                        </div>
                        <div className="blockstwo">
                            <div className="blocktwo all"></div>
                            <div className="blocktwo all"></div>
                        </div>
                        <div className="blocksthree">
                            <div className="blockthree all"></div>
                            <div className="blockthree all"></div>
                            <div className="blockthree all"></div>
                        </div>
                        <div className="blocksfour">
                            <div className="blockfour all"></div>
                            <div className="blockfour all"></div>
                            <div className="blockfour all"></div>
                            <div className="blockfour all"></div>
                        </div>
                        <div className="blocksfive">
                            <div className="blockfive all"></div>
                            <div className="blockfive all"></div>
                            <div className="blockfive all"></div>
                            <div className="blockfive all"></div>
                            <div className="blockfive all"></div>
                        </div>
                        <div className="blockssix">
                            <div id="blocksix" className="blocksix all"></div>
                            <div className="blocksix all"></div>
                            <div className="blocksix all"></div>
                            <div className="blocksix all"></div>
                            <div className="blocksix all"></div>
                            <div className="blocksix all"></div>
                        </div>
                    </div>
                </div>
            </div>
            <div className="vseymnojiteli">
                <ul>
                    <li>X2 Сохраняет результаттт раунда умноженный на два</li>
                    <li>Бросок с джокером которые поожет вам собрать хорогую комбинацию</li>
                    <li>Брсоить еще шесть кубиков чтобы получить еще больше очков за один ход</li>
                    <li>Отмена хода когда вы получаете ЗОНК</li>
                </ul>
            </div>
            <div className="kombinajii">
                <h2>Комбинации</h2>
                <div className="one">
                    <img src="https://www.zonkpro.ru/zonk/assets/dice/mini/1.png" alt="" /><p>100</p>
                </div>
                <div className="five">
                    <img src="https://www.zonkpro.ru/zonk/assets/dice/mini/5.png" alt="" /><p>50</p>
                </div>
                <div className="one_3">
                    <img src="  https://www.zonkpro.ru/zonk/assets/dice/mini/1.png" alt=""/>
                    <img src="  https://www.zonkpro.ru/zonk/assets/dice/mini/1.png" alt=""/>
                    <img src="  https://www.zonkpro.ru/zonk/assets/dice/mini/1.png" alt=""/>
                    <p>1000</p>
                </div>
                <div className="two_3">
                    <img src="  https://www.zonkpro.ru/zonk/assets/dice/mini/2.png" alt=""/>
                    <img src="  https://www.zonkpro.ru/zonk/assets/dice/mini/2.png" alt=""/>
                    <img src="  https://www.zonkpro.ru/zonk/assets/dice/mini/2.png" alt=""/>
                    <p>200</p>
                </div>
                <div className="three_3">
                    <img src="  https://www.zonkpro.ru/zonk/assets/dice/mini/3.png" alt=""/>
                    <img src="  https://www.zonkpro.ru/zonk/assets/dice/mini/3.png" alt=""/>
                    <img src="  https://www.zonkpro.ru/zonk/assets/dice/mini/3.png" alt=""/>
                    <p>300</p>
                </div>
                <div className="four_4">
                    <img src="https://www.zonkpro.ru/zonk/assets/dice/mini/4.png" alt=""/>
                    <img src="https://www.zonkpro.ru/zonk/assets/dice/mini/4.png" alt=""/>
                    <img src="https://www.zonkpro.ru/zonk/assets/dice/mini/4.png" alt=""/>
                    <p>400</p>
                </div>
                <div className="five_3">
                    <img src="  https://www.zonkpro.ru/zonk/assets/dice/mini/5.png" alt=""/>
                    <img src="  https://www.zonkpro.ru/zonk/assets/dice/mini/5.png" alt=""/>
                    <img src="  https://www.zonkpro.ru/zonk/assets/dice/mini/5.png" alt=""/>
                    <p>500</p>
                </div>
                <div className="six_3">
                    <img src="  https://www.zonkpro.ru/zonk/assets/dice/mini/6.png" alt=""/>
                    <img src="  https://www.zonkpro.ru/zonk/assets/dice/mini/6.png" alt=""/>
                    <img src="  https://www.zonkpro.ru/zonk/assets/dice/mini/6.png" alt=""/>
                    <p>600</p>
                </div>
                <div className="five_2">
                    <img src="https://www.zonkpro.ru/zonk/assets/dice/mini/2.png" alt=""/>
                    <img src="https://www.zonkpro.ru/zonk/assets/dice/mini/2.png" alt=""/>
                    <img src="https://www.zonkpro.ru/zonk/assets/dice/mini/2.png" alt=""/>
                    <img src="https://www.zonkpro.ru/zonk/assets/dice/mini/2.png" alt=""/>
                    <img src="https://www.zonkpro.ru/zonk/assets/dice/mini/2.png" alt=""/>
                    <p>200+200+200..</p>
                </div>
                <div className="hz_kakoe_name">
                    <img src="https://www.zonkpro.ru/zonk/assets/dice/mini/1.png" alt=""/>
                    <img src="https://www.zonkpro.ru/zonk/assets/dice/mini/1.png" alt=""/>
                    <img src="  https://www.zonkpro.ru/zonk/assets/dice/mini/5.png" alt=""/>
                    <img src="  https://www.zonkpro.ru/zonk/assets/dice/mini/5.png" alt=""/>
                    <img src="  https://www.zonkpro.ru/zonk/assets/dice/mini/5.png" alt=""/>
                    <img src="  https://www.zonkpro.ru/zonk/assets/dice/mini/5.png" alt=""/>
                    <p>3пары-750</p>
                </div>
                <div className="opiaty_hz_name">
                    <img src="https://www.zonkpro.ru/zonk/assets/dice/mini/1.png" alt=""/>
                    <img src="https://www.zonkpro.ru/zonk/assets/dice/mini/2.png" alt=""/>
                    <img src="  https://www.zonkpro.ru/zonk/assets/dice/mini/5.png" alt=""/>
                    <img src="https://www.zonkpro.ru/zonk/assets/dice/mini/4.png" alt=""/>
                    <img src="  https://www.zonkpro.ru/zonk/assets/dice/mini/5.png" alt=""/>
                    <img src="  https://www.zonkpro.ru/zonk/assets/dice/mini/5.png" alt=""/>
                    <p>стрит-1500</p>
                </div>
            </div>
        </div>
    </div>
    </div>
  );
}

export default App;
</code>```

Body:
My problem is that after changing sets, react nullifies the array by itself.
My code will check how many elements there are in the "sa" array and some value displays the one I need in the console, but when I wrote a variable change through useState (), the script erases my "sa" array after the conditions are met. In short, it works well with the console, but when I change the variable, it erases the array for me.
The problem is almost at the end of the script, where the loop for(let z of sa)

import { useEffect, useState, useRef } from 'react';
import './App.css';

function App() {
    // let map = new Map()
  //Функции
  function exit(){
    alert('Выйти')
  }

  let [music_stat, set_music_stat] = useState(1)
  function music(){
    if(music_stat){
      alert('Выключить звук')
      set_music_stat(music_stat = 0)
    }else{
      alert('Включить звук')
      set_music_stat(music_stat = 1)
    }
  }

  let [cubs, setcubs] = useState([
    {id:1,title:1, img:"https://www.zonkpro.ru/zonk/assets/dice/mini/1.png"},
    {id:2,title:2, img:"https://www.zonkpro.ru/zonk/assets/dice/mini/2.png"},
    {id:3,title:3, img:"https://www.zonkpro.ru/zonk/assets/dice/mini/3.png"},
    {id:4,title:4, img:"https://www.zonkpro.ru/zonk/assets/dice/mini/4.png"},
    {id:5,title:5, img:"https://www.zonkpro.ru/zonk/assets/dice/mini/5.png"},
    {id:6,title:6, img:"https://www.zonkpro.ru/zonk/assets/dice/mini/6.png"},
  ])

  let [raundco, setraundco] = useState(0)
  let [debcount, setdebcount] = useState(0)
  let [raund, setraund] = useState([
    {id:0, counter:0},
    {id:1, counter:0},
    {id:2, counter:0},
    {id:3, counter:0},
    {id:4, counter:0},
    {id:5, counter:0},
    {id:6, counter:0},
    {id:7, counter:0},
    {id:8, counter:0},
    {id:9, counter:0},
  ])

let [stroka,setstroka] = useState(6)

  let [cubikinapole, setcubikinapole] = useState([

  ])

  let list = []
  function sheker(){
    for(let i=0;i<6;i++){
      let randomcub = Math.floor(Math.random() * (6 - 0) + 0)
      let obj = {
        id: Date.now() + Math.random(),
        title: cubs[3].title,
        img: cubs[3].img
      }
      list.push(obj)
    }
    setcubikinapole([...cubikinapole, ...list])
    posa()
  }

  let map = new Map()

  function posa(){
          for(let key of list){
            if(map.has(key.title) == false){
                map.set(key.title, 1)
            }
            else{
                map.set(key.title, map.get(key.title)+1)
            }
        }
  }
    function save(){
        if(debcount <300){
            console.log('Вы не можете сохранить')
        }else{
            console.log('вы можете сохранить')
            setraund([...raund, raund[raundco].counter += debcount])
            // setraund(raund.at())
            // setraund([...raund[raundco], raund[raundco].counter += debcount])
            setraundco(raundco = raundco + 1)
            setdebcount(debcount = 0)
            setcubikinapole(cubikinapole = [])
            list = []
            map = []

        }
    }
    function deletea(){
        list = []
        map = []
        setcubikinapole(cubikinapole = [])
        console.log(list)
        console.log(cubikinapole)
        console.log(map)

    }
    // for(let key of cubikinapole){
        //     if(sa.has(key.title) == false){
            //         sa.set(key.title, 1)
            //     }
            //     else{
                //         sa.set(key.title, sa.get(key.title)+1)
                //     }
                // }
    let sa = new Map()
    let com3 = Object.fromEntries([
        [1,2], [3,2] , [6,2]
    ])
    let com4 = Object.fromEntries([
        [1,1],[2,1],[3,1],[4,1],[5,1],[6,1]
    ])
    let com1 = Object.fromEntries([
        [1,1]
    ])
    let com6 = Object.fromEntries([
        [4,3]
    ])

    function a(el){
            if(sa.has(el.title) == false){
                sa.set(el.title, 1)
                console.log('net new')
            }
            else{
                sa.set(el.title, sa.get(el.title)+1)
                console.log('est')
            }

        //Проверяем комбинацию 3пары
        if(JSON.stringify(com3) == JSON.stringify(Object.fromEntries(sa))){
            setdebcount(debcount+=750)
            console.log('3пары + 750очков')
            // setcubikinapole(cubikinapole = [])
            // list = []
            // map = []
            // sa= []
        }
        //Проверяем комбинацию стрит
        if(JSON.stringify(com4) == JSON.stringify(Object.fromEntries(sa))){
            setdebcount(debcount+=1500)
            console.log('Стрит! + 1500очков')
            // setcubikinapole(cubikinapole = [])
            // list = []
            // map = []
            // sa= []
        }

        //
        for(let z of sa){
            if(z[0] == el.title){
                if(z[1]==3){
                    console.log(z[0] + '00')
                    // setdebcount(debcount+= Number(z[0] + '00'))
                }else if(z[1] < 3){
                    console.log('Ничего')
                }
                else{
                    console.log(z[0]*2+'00')
                    // setdebcount(debcount+= Number(z[0] * 2 + '00'))
                }
            }
            console.log(z)
        }

        }

  return (

            <button onClick={()=>exit}>Выйти</button>
            <button onClick={()=>music}>Выключить звук</button>

JavaScript/React Js

Debug counter: {debcount}

                    {raund.map(el=>

{el.id + 1 +'. '+ el.counter}

                        )}

Общий счет

                    <button onClick={()=>save()}>Сохранить</button>
                    <button onClick={()=>deletea()}>Очистить поле</button>

Z

-Z

X2

+6

                    {cubikinapole.length !== 0 ?
                    cubikinapole.map((el)=>

a(el)}>

                    )
                    : console.log() }

                        sheker()}/>

X2 Сохраняет результаттт раунда умноженный на два

Бросок с джокером которые поожет вам собрать хорогую комбинацию

Брсоить еще шесть кубиков чтобы получить еще больше очков за один ход

Отмена хода когда вы получаете ЗОНК

Комбинации

100

50

1000

200

300

400

500

600

200+200+200..

3пары-750

стрит-1500

  );
}

export default App;


问:
Redux not updating the state in react native
My authSlice.js

```<code>import { createSlice } from "@reduxjs/toolkit"

const authSlice = createSlice({
    name: 'auth',
    initialState: {
        userToken: 1
    },
    reducers: {
        login: (state, action) => {
            if (state.userToken === 0) {
                state.userToken === 1
            } else if (state.userToken === 1) {
            state.userToken === 0
            console.warn(state.userToken)
        }

    },
})
</code>```

I am showing this in signin.js

```<code>const reduxtoken=useSelector((state)=>state.auth.userToken)

<Text style={styles.textDesign}>{reduxtoken}</Text>
</code>```

The initial state i can see on screen as 1.imported dispatch assigned usedispatch.

```<code>const OnSignInPressed = async () => {
    dispatch(login())
}
</code>```

But the state remains the same and initial state value 1 on screen is remaining same as before state is not changing.

store.js

```<code>import { configureStore } from '@reduxjs/toolkit'
import { setupListeners } from '@reduxjs/toolkit/query'
import { userAuthApi } from '../services/userAuthApi'
import cartSlice from './cart-slice'
import authSlice from './auth-slice'

export const store = configureStore({
    reducer: {
        [userAuthApi.reducerPath]: userAuthApi.reducer,
        cart: cartSlice.reducer,
        auth: authSlice.reducer
    },
    middleware: (getDefaultMiddleware) =>
        getDefaultMiddleware({
            serializableCheck: false,
            immutableCheck: false
        }).concat(userAuthApi.middleware)
})

setupListeners(store.dispatch)
</code>```

Body:
My authSlice.js

import { createSlice } from "@reduxjs/toolkit"

const authSlice = createSlice({
    name: 'auth',
    initialState: {
        userToken: 1
    },
    reducers: {
        login: (state, action) => {
            if (state.userToken === 0) {
                state.userToken === 1
            } else if (state.userToken === 1) {
            state.userToken === 0
            console.warn(state.userToken)
        }

    },
})

I am showing this in signin.js

const reduxtoken=useSelector((state)=>state.auth.userToken)

<Text style={styles.textDesign}>{reduxtoken}</Text>

The initial state i can see on screen as 1.imported dispatch assigned usedispatch.

const OnSignInPressed = async () => {
    dispatch(login())
}

But the state remains the same and initial state value 1 on screen is remaining same as before state is not changing.

store.js

import { configureStore } from '@reduxjs/toolkit'
import { setupListeners } from '@reduxjs/toolkit/query'
import { userAuthApi } from '../services/userAuthApi'
import cartSlice from './cart-slice'
import authSlice from './auth-slice'

export const store = configureStore({
    reducer: {
        [userAuthApi.reducerPath]: userAuthApi.reducer,
        cart: cartSlice.reducer,
        auth: authSlice.reducer
    },
    middleware: (getDefaultMiddleware) =>
        getDefaultMiddleware({
            serializableCheck: false,
            immutableCheck: false
        }).concat(userAuthApi.middleware)
})

setupListeners(store.dispatch)


问:
how to add a query that checks capitalized values in the aggregate method in mongoose?
I am trying to lookup a value in "Last_Name" and compare it with with another "First_Name" field.  it if it is capitalized return value if not check the value in small case. how do I add a query in the aggregate method?</p>
```<code>  {
    $lookup: {
      from: "Information",
      localField: "First_Name",
      foreignField: "Last_Name",
      as: "Without_array"
    }
  },
  {
    $project: {
      First_Name: 1,
      Last_Name: 1,
      Address: {
        $arrayElemAt: [
          "$Without_array.Address",
          0
        ]
      }
    }
  }
])
</code>```

Body:
I am trying to lookup a value in "Last_Name" and compare it with with another "First_Name" field.  it if it is capitalized return value if not check the value in small case. how do I add a query in the aggregate method?

  {
    $lookup: {
      from: "Information",
      localField: "First_Name",
      foreignField: "Last_Name",
      as: "Without_array"
    }
  },
  {
    $project: {
      First_Name: 1,
      Last_Name: 1,
      Address: {
        $arrayElemAt: [
          "$Without_array.Address",
          0
        ]
      }
    }
  }
])


问:
Cannot use import statement outside a module when using wrangler v2
I'm new to using cloudflare and wrangler. I've a project that I've been working on, and I'm now trying to deploy it using wrangler publish, but I keep running into issues. My product is coded in node.js, and I'm using version 2 of wrangler. When I execute wrangler publish I get:

```<code>Basic JavaScript project found. Skipping unnecessary build!
Error: Something went wrong with the request to Cloudflare...
Uncaught SyntaxError: Cannot use import statement outside a module
  at worker.js:2Basic JavaScript project found. Skipping unnecessary build!
Error: Something went wrong with the request to Cloudflare...
Uncaught SyntaxError: Cannot use import statement outside a module
  at worker.js:2
</code>```

I've searched for a solution, and one of them that I found said to change module in wrangler.toml from type="javascript"to type="webpack" however that gives me a bunch of errors:

```<code> ./node_modules/destroy/index.js
Module not found: Error: Can't resolve 'fs' ... Parsed request is a module...resolve as module
      /Users/Desktop/APIs/cpiCalculator2/node_modules/destroy/node_modules doesn't exist or is not a directory
...
Error: webpack returned an error. You may be able to resolve this issue by running npm install.
</code>```

I've tried reinstalling npm as it suggests and then wrangler publish again, but that just gives me the same error message.

I'm really not sure what the issue is, and I would really appreciate any help or advice on how to resolve this issue. Thank you!

Also, just a note, I'm not sure if this is affecting it, but I do have two other js documents in the main area of my project (where my index.js file is).

Body:
I'm new to using cloudflare and wrangler. I've a project that I've been working on, and I'm now trying to deploy it using wrangler publish, but I keep running into issues. My product is coded in node.js, and I'm using version 2 of wrangler. When I execute wrangler publish I get:

Basic JavaScript project found. Skipping unnecessary build!
Error: Something went wrong with the request to Cloudflare...
Uncaught SyntaxError: Cannot use import statement outside a module
  at worker.js:2Basic JavaScript project found. Skipping unnecessary build!
Error: Something went wrong with the request to Cloudflare...
Uncaught SyntaxError: Cannot use import statement outside a module
  at worker.js:2

I've searched for a solution, and one of them that I found said to change module in wrangler.toml from type="javascript"to type="webpack" however that gives me a bunch of errors:

 ./node_modules/destroy/index.js
Module not found: Error: Can't resolve 'fs' ... Parsed request is a module...resolve as module
      /Users/Desktop/APIs/cpiCalculator2/node_modules/destroy/node_modules doesn't exist or is not a directory
...
Error: webpack returned an error. You may be able to resolve this issue by running npm install.

I've tried reinstalling npm as it suggests and then wrangler publish again, but that just gives me the same error message.

I'm really not sure what the issue is, and I would really appreciate any help or advice on how to resolve this issue. Thank you!

Also, just a note, I'm not sure if this is affecting it, but I do have two other js documents in the main area of my project (where my index.js file is).