Revamp sample

Only show relevant database code to setup adapter and send messages
Reorganize strings
Reorganize sample item order

@SUPERCILEX thanks for sending this over.  I see what you're trying to do with the base classes, it highlights only the FirebaseUI code and abstracts the boilerplate.
However I think that's a non-goal of this sample.  The README is where we can highlight code snippets without context.  The sample activity shows the code you actually need to wire this library into your app.  By adding base activities we sweep this complexity under the rug but the developer is going to need to look at it anyway to see how to actually put FirebaseUI in their app.

I think that's a non-goal of this sample

Let me try to convince you otherwise. 😄
Over the time I've worked on FirebaseUI, I've noticed a fundamental disconnect for newbies between their understanding of the RecyclerView and the adapter. A significant portion of them seem to think that FirebaseUI-Database and the RecyclerView are the same thing. I actually feel like I thought something similar when I first started!
The problem as I see it is that we don't link to the support library documentation and instead try to teach all the RecyclerView goodness in our own README. In addition, we hide the normal RecyclerView.Adapter abstraction behind reflection and a weirdly named method like populateViewHolder(...). While we're doing those other refactors 😉, I think we should actually just remove those methods and have the dev implement onCreateViewHolder(...) and onBindViewHolder(..., T model) themselves.
Going back to the sample, for newbies I think a clear separation between modular adapters and the actual RecyclerView is necessary. If we beef up our README to include tutorials from the support library about how to setup a RecyclerView, I think this will provide a very clear separation between "How do I setup a general RecyclerView?" and "How do I provide data to the RecyclerView?". Our current sample throws everything at newbies all at once whereas the new provides clear classes that answer the questions "How do I write data to the database and then read it back?" and "How do I prepare a RecyclerView for receiving data?". What I'm basically saying is that we need clear RecyclerView and RV.Adapter education that isn't confusingly mixed together.
@samtstern What do you think given the points above?
PS: if you want proof of the confusion, have a look at #648 where a dev crashed the RecyclerView, #672 where a dev didn't setup the RecyclerView height correctly, #556 and #482 where a dev didn't understand RecyclerView animations, #472 where a click listener wasn't working for some reason, #457 where a dev didn't know he had to call RecyclerView#setAdapter(...), and a whole bunch more. There's evidence aplenty! :smile:

@samtstern went back to merging the sample after our internal discussion.

Note here: @SUPERCILEX and I are working on some API changes that will alleviate some of the pain points (which are enumerated above in detail) and then we will revisit this issue once those changes land.
There are still definitely some sample improvements we should take from this PR, but hopefully fewer once the API improves.

@samtstern I think this PR is ready for another round of review. The Git diff got messed up because of the name change, but a lot changed anyway:

Merged improvements from intertal developeent

Use ButterKnife
Auth listener is tied to start/stop lifecycle instead of create/destroy

Pressing enter on keyboard sends message
Other miscellaneous reorganization

@SUPERCILEX thank you!  This looks great now.  I really appreciate the back-and-forth here.  Once we're ready to land 3.0 we can revisit some of your other sample concerns and make sure they're all addressed.

Awesome, time to work on that internal sample revamp PR! 😄


Dev: Web - Console error on create new workspace

If you haven’t already, check out our contributing guidelines for onboarding and email<EMAIL_ADDRESS>to request to join our Slack channel!

Action Performed:

Click on FAB icon
Create a new workspace and check the console

Expected Result:
Should not show any console error
Actual Result:
Console error appears (Invalid prop reports.report_5370990936798009.writeCapability of value daily supplied to ReportScreenWrapper, expected one of ["all","admins"].
)
Workaround:
Unknown
Platforms:

Which of our officially supported platforms is this issue occurring on?

[ ] Android / native
[ ] Android / Chrome
[ ] iOS / native
[ ] iOS / Safari
[x] MacOS / Chrome / Safari
[ ] MacOS / Desktop

Version Number: Dev 1.3.45-8
Reproducible in staging?: no
Reproducible in production?: no
If this was caught during regression testing, add the test name, ID and link from TestRail:
Email or phone of affected tester (no customers):
Logs: https://stackoverflow.com/c/expensify/questions/4856
Notes/Photos/Videos: Any additional supporting documentation
https://github.com/Expensify/App/assets/93399543/29f5fa5f-9777-45a2-b1cd-3a9d0b5fd3ae
Expensify/Expensify Issue URL:
Issue reported by: @gadhiyamanan
Slack conversation: https://expensify.slack.com/archives/C049HHMV9SM/p1690356298944369
View all open jobs on GitHub

Proposal
Please re-state the problem that we are trying to solve in this issue.
Console error for new workspace or request money action
What is the root cause of that problem?
It is a regression from PR https://github.com/Expensify/App/pull/21950 where we have added an extra param writeCapability for the function buildOptimisticChatReport but not passed from all required buildOptimisticChatReport called occurrences.
https://github.com/Expensify/App/pull/21950/files#diff-65c096044d5f69b35bcdec14c99c4fda4580759df9b1a7c36650d58eea276f1dR1763
https://github.com/Expensify/App/blob/1fac96bba4f60e5258c43953817b1f31f6b3d3c7/src/libs/ReportUtils.js#L2002-L2014
https://github.com/Expensify/App/blob/1fac96bba4f60e5258c43953817b1f31f6b3d3c7/src/components/ReportActionItem/MoneyRequestAction.js#L100-L115
What changes do you think we should make in order to solve the problem?
We need to pass writeCapability param with the correct value in both places.

Hi, I’m Michael (Mykhailo) from Callstack and I would like to work in this issue, because I am the author of the broken PR.

Self-assigning since this is a regression from https://github.com/Expensify/App/issues/21456

@amyevans can we remove needs reproduction label then, as am assuming you can repro?

Good call, done!

@amyevans can you please check that I have reported this https://github.com/Expensify/App/issues/23647 bug before this https://github.com/Expensify/App/issues/23638 one
@Pujan92  mentioned they have same RCA

@amyevans @rezkiy37  please check that here is the root case of this issue  https://github.com/Expensify/App/issues/23647 that i have reported before PR deployed on staging and i have reported before this bug https://github.com/Expensify/App/issues/23638

@amyevans @rezkiy37 please check that here is the root case of this issue #23647 that i have reported before PR deployed on staging and i have reported before this bug #23638

The root case is same. I fixed it here - https://github.com/Expensify/App/pull/23815.

@rezkiy37  yes it's fixed but i have reported this bug https://github.com/Expensify/App/issues/23647 before this one https://github.com/Expensify/App/issues/23638

@rezkiy37 yes it's fixed but i have reported this bug #23647 before this one #23638

Sorry, but I am a person who process such kind of questions. I am not an Expensify employee, I work at Callstack.

@laurenreidexpensify offer accepted, Thank you

@laurenreidexpensify there is no payment for me, this was a regression. Payment will be handled in the policy-admin issue.

Payment Summary:

Bug reporter: @gadhiyamanan - $250, offer sent in Upwork AND @ayazhussain79 - $250, offer sent in Upwork
Contributor: @rezkiy37 - no payment, CallStack employee
C+: @mananjadhav -no payment as this was a regression

Closing out as the regression testing will be handled in the original issue


Bot needs Message Content Intent

Bug Description
Since september 1st, bots require Message Content Intent to read channel messages. It can be temporarily set in the Discord Developper Portal, but a warning says "Verified apps may re-enable message content until October 1, 2022. Doing so will stop your bot from joining more servers until disabled."
Steps to Reproduce
Tried sending commands to the bot but it doesn't see them
Expected Result
The bot is supposed to see the commands sent in chat
Debug Output
version 0.3.8
Additional Info
No response
Checklist

[X] I have looked for information about this within the documentation
[X] I have searched for similar issues on the issues page
[X] I am running the latest version of the bot:

I published a message in my development server about this. This is something you'll need to do yourself, it's not a modification to the bot. Here's the original message for people who aren't in the server:

If your music bot stopped responding to commands today, it may have been because of the recent Discord rollout to intents changes. If you bot is on more than 75 servers, it will likely be permanently broken. However, if you've kept it private (as intended), here's what you'll need to do:

Head on over to https://discord.com/developers/applications and find your bot application.
Click on the Bot tab on the sidebar (see first image below)
Turn Message Content Intent (should be the last checkbox on the page) ON
Make sure your checkboxes match the ones I have shown (see second image below)

Thank you, so nothing else should be done by October 1st? I will close this =)

Assuming your bot is private and on less than 75 servers, enabling this should be all you need to do; you shouldn't need to do anything come Oct 1st.


chore: add rh-rahulshetty user to perf-team alias

Description
Adding my profile (rh-rahulshetty) to the perf-team alias for reviewing team's code changes.
Issue ticket number and link
N/A
Type of change

[ ] Bug fix (non-breaking change which fixes an issue)
[ ] New feature (non-breaking change which adds functionality)
[ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
[ ] This change requires a documentation update
[x] Other

How Has This Been Tested?
N/A
Checklist:
N/A

/verify-owners

/retest


Support to specify Surface Capabilities

Currently, all requests are sent from as a device which supports Audio surface only. But, many actions support multiple surfaces and send different responses depending on the surface.
At least, I think that this tool should support a screen surface. For example, if developers can specify whether want to support a screen surface or not as like the following, we will be able to cover more test cases/conditions.
const action = new ActionsOnGoogleAva(...);
...
action.screenSurfaceSupport = true;  // Default value is false
action.start(...);

I agree this is a useful change. It does require some server-side changes to accommodate.

It does require some server-side changes to accommodate.

@Fleker Probably, we can support to the screen surface by the following code below:
    send(input: string): Promise<AssistResponse> {
        const config = new embeddedAssistantPb.AssistConfig()
        ...
        config.setAudioOutConfig(new embeddedAssistantPb.AudioOutConfig())
        ...
        // Add two lines below:
        config.setScreenOutConfig(new embeddedAssistantPb.ScreenOutConfig())
        config.getScreenOutConfig().setScreenMode(3)
        ...

If we add the lines above, the result of conv.surface.capabilities.has('actions.capability.SCREEN_OUTPUT'); is true in a fulfillment code. That is, it does not require any server-side changes, I guess.
Do you have other reasons which we need to change the server-side code?

I have started using action-on-google-testing package for our enterprise bot. During testing, I found some issue regarding failed scenarios -:
1.sometime intent doesn't match with my utterance.
2. When I enable fulfillment for webhook, I not getting any response but when I disable the fulfillment and added static response that time it was working fine.
error:
2 exceptions
Uncaught Exception
TypeError: Cannot read property 'url' of undefined
ClientDuplexStream.conversation.on (node_modules/actions-on-google-testing/src/actions-on-google.ts:559:62)
Object.onReceiveMessage (node_modules/grpc/src/client_interceptors.js:1292:19)
InterceptingListener.recvMessageWithContext (node_modules/grpc/src/client_interceptors.js:607:19)


Typescript predicts wrong type when using intersection types as parameters in overloaded function signatures

Bug Report
Consider the following:
interface Options {
    complete: boolean;
}

function f(options: Options & { complete: true }): ReturnTypeA;
function f(options: Options): ReturnTypeB;
function f(options: Options): ReturnTypeA | ReturnTypeB {
    // implementation here. See playground link for full example.
}

const completeIsTrue: Options = {
    complete: true
};

const result = f(completeIsTrue);
const result2 = f({ complete: true });

When run, the code executes correctly with both result and result2 being of type ResultTypeA, however in an editor (tested VSCode and TS Playground), Intellisense thinks result is ReturnTypeB.

This causes problems because Intellisense will then offer incorrect autocomplete suggestions and mark valid code as errors.
🔎 Search Terms
intersection types
function overloading
🕗 Version & Regression Information
Tested 4.4.3 and nightly.

This is the behavior in every version I tried, and I reviewed the FAQ for entries about function overloading and intersection types.

⏯ Playground Link
Playground link with relevant code
💻 Code
My example demonstrating the problem is above. The actual code that is causing this issue is:
export function decode(token: string, options: DecodeOptions & { complete: true }): null | Jwt;
export function decode(token: string, options: DecodeOptions & { json: true }): null | JwtPayload;
export function decode(token: string, options?: DecodeOptions): null | JwtPayload | string;

This is from the type definition package for jsonwebtoken.
🙁 Actual behavior
Type hints generated by Intellisense/static analysis are wrong when function overloads use intersection types. Seems to have something to do with object literals as well?
🙂 Expected behavior
The correct type hints.

intersecting types with similar properties sometimes results in properties having the type never.

A & B at a high level means "a type which is simultaneously assignable to both A and B”.  For object types, this usually just means you get a type with both sets of properties (because extra properties can be present and still be assignable to the original type), but if there’s overlap then the overlapping properties have to be intersected too, and that means you sometimes get never: there is no value that is simultaneously assignable to both string and number, for instance, so string & number reduces to never—an empty set.

function f(options: Options & { complete: true }): ReturnTypeA;
function f(options: Options): ReturnTypeB;
function f(options: Options): ReturnTypeA | ReturnTypeB {
    // implementation here. See playground link for full example.
}

This signature can’t be correct. The fundamental problem is that if you have an Options, its complete property might be true—you don’t know. If values like { complete: true } always return ReturnTypeA, the second overload must be wrong, because that overload will be matched for Options where complete is an unknown boolean. Probably what you meant is
function f(options: Options & { complete: true }): ReturnTypeA;
function f(options: Options & { complete: false }): ReturnTypeB;
function f(options: Options): ReturnTypeA | ReturnTypeB;
function f(options: Options): ReturnTypeA | ReturnTypeB {
    // implementation here. See playground link for full example.
}

So here we say that if we know that options.complete is true or false we can match the appropriate overload and get the corresponding narrower return type. But if we don’t know what options.complete is (beyond the fact that it must be a boolean), of course our return type is going to be ReturnTypeA | ReturnTypeB. (Note also that the implementation signature doesn’t actually count as an overload, so the last one has to be duplicated. From the caller’s perspective, it doesn’t matter what goes in it. This is handy when you have so many overloads with no common supertype so you just put some anys in there and deal with it.)


Delete input from md-datepicker

Bug, feature request, or proposal:
Request
What is the expected behavior?
When a date is chosen with the md-datepicker, a button should appear which can delete the value of the input field.
What is the current behavior?
There is no button to delete the input field after a value is set.
What is the use-case or motivation for changing an existing behavior?
It is easier for the user to delete the input with a button instead of deleting it with the keyboard and if the input field is disabled the user is not able to delete is, therefore a button is needed.
Which versions of Angular, Material, OS, TypeScript, browsers are affected?
Angular: 4.2.4
Material: 2.0.0-beta.8

@Leonzen, you can achieve it with almost no effort.
Take a look at this plunker: https://plnkr.co/edit/S3tG9z?p=preview

As @julianobrasil showed, you can add something like with with the input suffix.


Token filters - hyphenation_decompounder [DOC]

What do you want to do?

[ ] Request a change to existing documentation
[x] Add new documentation
[ ] Report a technical problem with the documentation
[ ] Other

Create a separate page for Token filter: hyphenation_decompounder
Part of META issue: https://github.com/opensearch-project/documentation-website/issues/1483
*Version: all

@natebower I can take this one


Implement Worksite Filters in Create New Team

Description
Add a cases filter when creating a new team, which should include lists.
Screenshots

Steps to Reproduce
Tasks

Add worksite filter in red box so that you can filter worksites shown below


Add sources for every TVB Fictional Countries/Islands entry

Sources needed
TVB Fictional Countries
Ng Wong Tat

[x] Introduction
[x] Geography
[x] Culture
[x] Politics

awoo cringe

[x] The whole page

Shi Hou Guo

[x] Introduction
[x] Geography
[x] Culture

Nv Er Guo

[x] The whole page

Wu Duo Guo

[x] The whole page

Hao Duo Guo

[x] The whole page

Ha Duo Er

[x] The whole page

Unnamed Country 1

[x] The whole page

TVB Fictional Islands
Island de Orange

[x] Introduction
[x] Politics

Gu Li Wu Dao

[x] The whole page

Kun Li Wu Dao

[x] The whole page

Pu Tao Wu Dao

[x] The whole page

An Ling Wu Dao

[x] The whole page

E Li Wu Dao

[x] The whole page

Lian Le Wu Dao

[x] The whole page

Guai Li Wu Dao

[x] The whole page

Fan Bo Wu Dao

[x] The whole page

Hung Island

[x] The whole page

Shan La Ga Islands

[x] The whole page

Ji Wo Islands

[x] The whole page

Qiong Kun Lao Island

[x] The whole page

this took way too long

we're done (for)

NOTE: The Shan La Ga Islands could NOT be traced


Alerts refactor

process replay differences so far:

controlsState.alertType differences due to actual event name being used (e.g., enable -> pcmEnable)

changes

better defined relationship between alerts and events
remove duplicated code in alert definitions
remove unused alerts

geofence
dataNeeded ("Calibration Needs Data. Upload Drive, Try Again")

Will clean up things on the controlsd side in the controlsd refactor.

Should we have "events.append(create_event(.." everywhere or what about making events a class? like "events.add_new_event(..."

@geohot What do you think? There's more to clean up in controlsd, but this PR is already pretty big. I think it can go in the controlsd refactor

@pd0wm would be the one to review this code really, I'm not that familiar with it. But I'm reading now.

I like the overall refactor with the event types being separate from the events themselves.
Why is there still an ALERTS? Why aren't these EVENTS?

I kept ALERTS around as we show some alerts that don't meet the definition of an event, things that cause controls state machine transition. However, we have a bunch of events that only have the warning type, which means they don't satisfy that definition. We can either open up the definition of an event or move those warning only events to alerts. I'm leaning towards moving those alerts to warning only events, but I'll think about it some more.


Travis fix

Travis seems to be failing
<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><>  🐫
∗ installed base-bigarray.base
∗ installed base-threads.base
∗ installed base-unix.base
∗ installed ocaml-base-compiler.4.07.1
∗ installed ocaml-config.1
∗ installed ocaml.4.07.1
Done.
# Run eval $(opam env) to update the current shell environment
The following dependencies couldn't be met:
  - io-page → ocaml < 4.06.0
      base of this switch (use `--unlock-base' to force)
No solution found, exiting
The command "opam --version && opam init && opam install uri qcow-format io-page.1.6.1 ocamlfind conf-libev" failed and exited with 20 during .

Updated io-page gets past error. Other issues exist which seem separate from the original.


Use node 10 in travis

I noticed this was still using Node 8.  Any reason for that?
I bumped it to Node 10, which is the current LTS version

@mramato ?

Node 8 is still widely used and still officially supported by the Node foundation, we probably shouldn't switch to 10 until 8 support is official done or general usage has dwindled to nothing (or we have a really good reason).


Fixed StagingDeployCash issue body

Details

Added pagination so that all the automated PRs can be filtered while creating the StagingDeployCashBody issue Body.
Fixed Issues

$ fixes #3662
Tests

QA Steps

Tested On

[ ] Web
[ ] Mobile Web
[ ] Desktop
[ ] iOS
[ ] Android

Screenshots

Web

Mobile Web

Desktop

iOS

Android

I think I need help with the Check here. I am not sure exactly why its failing, on local gh-action-validate has no errors.

Thanks for the detailed Info. but I built actions before pushing. I will try again.

@parasharrajat Do you have a windows computer?

No

Try running .github/scripts/verifyActions.sh locally?

Okay, next I would try this:
rm -rf node_modules
npm i
npm run gh-actions-build
./github/scripts/verifyActions.sh

Other than that, you have to look through the diff and try to find out what's going on/why there is a difference. IDK what Linux flavor you have, but that might matter - you could try running the build script in an Ubuntu 20.04 VM?

Updated. Thanks.

Updated. Ready for review.

:hand: This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release.

🚀 Deployed to staging in version: 1.0.74-1🚀

platform
result

🤖 android 🤖
success ✅

🖥 desktop 🖥
success ✅

🍎 iOS 🍎
success ✅

🕸 web 🕸
success ✅


Custom labels not being created in delta package

Describe the bug
When running the sfpowerkit:project:diff command, the delta that is created is missing custom labels. All of the other metadata appears to be correct, apex class, lwc, layouts etc were all created. An empty labels folder is created in the delta package.
I have a pull request open where I can see the changes for custom labels, if I switch branches and do a manual diff on the custom labels file I can see the custom label changes are correct on the branches.
To Reproduce
Steps to reproduce the behavior:

sfdx sfpowerkit:project:diff --revisionfrom branch1--revisionto branch2 --output deltaPackage

Expected behavior
Custom label file created with the new custom label values
Screenshots
If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

OS: Windows
Node Version - v12.18.3
Version of sfpowerkit - latest (Have also tried beta)
Salesforce Org Version Spring '21 Patch 7.1

Additional context
Custom labels seem to be the only metadata not being created. Everything else in the pull request is in the delta package.

@SeanCarroll1 can you check the diff.json in deltaPackage folder see if you can find the labels there.
It is working for me.

Hi @manisfdcsfdx
I created a new branch with one new custom label and tried creating a delta between the two.

The diff.json is empty, it does have the labels folder so it seems it does recognize it is where the difference is.
In your screenshot, the delta package looks like it's in metadata format? rather than source format.
In the documentation for the project diff command, it says "This command works with a source format based repository only. Utilize the command during a transition phase where an org is transformed to a modular architecture composing of multiple projects."

Hey @SeanCarroll1, No Actually my project is in source format only.  looks like you are the one using metadata format. in your screenshot i can see custombales.labels which is metadata format extension. source format will have extension as CustomLabels.labels-meta.xml

Hey @manisfdcsfdx
The -meta.xml portion is hidden, I am using intellij & illuminated cloud (It also hides the meta file for LWC). I attached images of the branch's metadata in VS code. Below is the same branch.

I ran the command sfpowerkit:project:diff again with logs

Same result with an empty label folder and diff.json

It doesn't appear to copy it over for custom labels. I added a comment to one of the apex classes and committed it to the same branch that has a label change.  I can see the command copying the apex class over and it does appear in the delta package.

Is there something I am missing specifically for custom labels? Thanks.

@SeanCarroll1  may i know what is your api version in your sfdx-project.json. I will try it out again in fresh repo and get back to you.

Hi @manisfdcsfdx, of course
{   "packageDirectories": [     {       "path": "force-app",       "default": true     }   ],   "namespace": "",   "sfdcLoginUrl": "https://login.salesforce.com",   "sourceApiVersion": "50.0" }
Let me know if anything else, thanks

@SeanCarroll1 I forked lwc-recipes repo did some digging looks everything working fine.
Created a PR 1 to added a new custom label file and committed the delta result as well.
Created a PR 1 to add and remove custom label in existing file and committed the delta result as well.
can you check this.

Hi @manisfdcsfdx,
I cloned your repo and ran the same command and received an error - parsing diff

I tried reinstalling the plugin, sfdx and vs code but still receiving this error. I've not made any changes to the branch.

@SeanCarroll1 - Interesting i will do some more digging again in different OS also, will get back. @azlam-abdulsalam any thoughts ?

@SeanCarroll1  @manisfdcsfdx  let me get back to both of you. Thx!

@SeanCarroll1 i tested in different machines and different OS cant find any issue. is it possible for you to test this in any other machine and confirm the behavior over there?

Hi @manisfdcsfdx ,
I can confirm that it worked on another computer when I cloned your repo and ran the same commands.
I will try to look into what is causing the issue, the only difference I am aware of isthe  java version is older on the laptop that the commands do not work on.

Thanks for the confirmation @SeanCarroll1, I will keep this issue open for now and let us know if you anything that is making this inconsistency. If there is any issue with the command we will try to fix else we can close it.


intercept 401 responses and redirect

Is it possible to intercept all responses and see if I get 401 and redirect to login page?
In React: Is it the appropriate way to go?

I'd like to know the answer to this as well.

@rlambertsen looks good. Thanks!

Thanks for the code example. Just curious, are you able to use this without the user getting a dialog in their face, first, asking for user name and password ("Authentication Required")?

Got same issue. This dialog appear before interceptor and interceptor called after this dialog closed (no matter how cancelled or submitted).

Hi, The api gives me Status Code:401 UNAUTHORIZED error.
But am not able to get the response code using vue-axios interceptor, am getting undefined for error.response.
Axios<EMAIL_ADDRESS><EMAIL_ADDRESS>

@NanoDev777 Can you show me the code you are using? Also make sure you are updating the token or using the new one in the next request like so
originalRequest.headers['Authorization'] = 'Bearer ' + store.state.token // new header new token

@rlambertsen sorry to ask.  i have a doubt that what if " return Vue.axios(originalRequest) " returns a 400 bad request error and how to handle it.

@rlambertsen what does the post to users/token do?

Just curious -  If you use window.location, won't it reload the page and all state will be lost?

@james-poulose  I'm also wondering about it.
Any ideas I want to redirect to a specific page

@james-poulose Yes window.location causes the window to reload;
@nsarvar Each request is handled individually and if you just wrote some code to retry them it would do just that. Look at this line and see how I save the request above so it can be retried
return Vue.axios(originalRequest) // retry the request that errored out
set a condition and test for it;
@notflip the post clears the users token in the db so they can set a new on the retry;
@adshin21 you can redirect anywhere you want at anytime in the code snippet above. Set a condition and test for it, if you want to stay inside vue use vue-router to handle it or window.location to go outside your vue app

@james-poulose  Thank you for your quick response.
As I'm using request interceptors ( in react ) and inside that checking for the expiry of the token, if the access token is expired calling the token refresh method and setting the new tokens but if the refresh is also expired then I want to redirect from there. In short, I want to redirect from the request interceptors without using window.location.href or window.reload.
Thank you.

@james-poulose you want to use whatever React is using for routing. In Vue.js you can redirect inside the app not using window.location by using vue-router. I assume React-router works the same way by internally routing the user to any page in the app.
Vue-router code inside the main.js where the axios global code lives;
router.push('/search')
I found a neat article that actually explains what you want in React apps
https://bilot.group/articles/using-react-router-inside-axios-interceptors/

@adshin21 you want to use whatever React is using for routing. In Vue.js you can redirect inside the app not using window.location by using vue-router. I assume React-router works the same way by internally routing the user to any page in the app.
Vue-router code inside the main.js where the axios global code lives;
router.push('/search')
I found a neat article that actually explains what you want in React apps
https://bilot.group/articles/using-react-router-inside-axios-interceptors/


Protractor parameters are not including text after spaces

Current behavior

Try gulp test:acceptance --platform='OS X 10.9' --sauce and this line will have platform set to OS, not the full string with spaces, which leads to a Sauce error since the OS version is not specified.

Expected behavior

It's possible to pass quoted strings as a command-line parameter value.

Can't repeat this, appears to be fixed!


Date Picker year dropdown doesn't allow selecting year when minDate is set to that year

Latest version

[X] I have tested the latest version

Description
When minDate is set to the middle of year, then year dropdown doesn't allow me to select that year
Steps to reproduce
Set minDate to mid year, use date picker, open calendar, open year dropdown, select the year, can't navigate to it (the year)
https://stackblitz.com/edit/salt-template-qkpnti?file=App.tsx
Expected behavior
No response
Package name(s)
Lab (@salt-ds/lab)
Package version(s)
52
Browser

[X] Chrome
[ ] Safari
[ ] Firefox
[ ] Microsoft Edge

Operating system

[X] macOS
[ ] Windows
[ ] Linux
[ ] iOS
[ ] Android

Are you a JPMorgan Chase & Co. employee?

[X] I am an employee of JPMorgan Chase & Co.

With #4291, minDate will limit year dropdown, and should be able to navigate to it


Mock when using a transaction (or not)

Hi,
As far as we can go we succeeded to mock everything but the Transaction.
Instead of passing the pool we used a top wrapper containing all struct using a db.
I'll try to provide an example of how we did things (feel free to correct, advise us on that too as we are on the learning curve of Rust).
Something like this:
pub struct DatabaseWrapper {
   pg_pool: Arc<PgPool>, // not use anymore except for maybe transaction.
   user_db: Arc<UserDB>,
   order_db: Arc<OrderDB>,
}
pub struct UserDB {
   pool: Arc<PgPool>,
}
trait UserDBFn for UserDB {
 async fn find_by_id(user_id: Uuid) ...
}

So everything is fine in our services we can mock services and we can 100% mock the *db module containing only SQL stuff.
Example:
impl ServiceAFn for UserService {
  async fun me (user_id: Uuuid, b_wrapper: &DatabaseWrapper) -> Result ... {
   ...
   db_wrapper
      .get_user_db()
      .find_by_id(user_id)
      .await?;
   ...
  }
}

Easy mocked with something like this:
  lert mut user_db_mocked = MockUserDBFn::new()
  user_db_mocked
      .expect_find_by_id()
      .times(1)
      .returning(|_| {None});
  let mut db_wrapper_mocked = MockDatabaseWrapperT::new();
    db_wrapper_mocked
      .expect_get_user_db()
      .return_const(user_db_mocked);

So ok ... a lot's of boilerplate to me way more than we would like to have but we won't fight if it's usual.
The situation is we are facing a wall to do something similar for the transaction.
In a service:
let mut tx = db_wrapper.get_pool().begin().await?;
...
db_wrapper
      .get_user_db()
      .register_user(userStructForCreation, &mut tx).await?
...
tx.commit().await?;

So here we really don't know how to mock the transaction part, we tried to create also a wrapper around the transaction but as it is a mutable objet we didn't succeed of writing it ... (we used 'static as we saw it in your source code, tried something else but it doesn't work)

pub struct TransactionWrapper {
  pub tx: Arc<Transaction<'static, Postgres>>,
}
pub trait TransactionHelper {
  fn build<'c>(tx: Arc<Transaction<'static, Postgres>>) -> Self;
  async fn commit(&self) -> Result<(), ApiError>;
}
pub trait DatabaseWrapperT {
 ...
  async fn start_transaction(&self) -> Result<TransactionWrapper, ApiError>; // Use it's pool to create a tx wrapper and returning it
 ...
}

In the service
let transaction_wrapper = db_wrapper.start_transaction().await?;

It's ok for the build/start transaction but ... for the commit we didn't achieved to write something that compile (maybe/mostly) due to the lifetime or this complicated pattern.
==> Is there any way to write it (without discarding automock as we think lifetime cannot be put on trait)

I feel like we are on the edge about that, is it really not too overkill ? (in java very easy with injection, in Haskell easier with algebraic effect with Polysemy).
We thought it could be a good idea to use Sqlite during test but we are loosing everything we loved sqlx for, query_as! is out and we had to write query like in 2000, parsing/accessing AnyRow manually with index (a nightmare for stability) so this is not an acceptable solution for us.

It seems don't have a lot of options here as we really don't want to start a dedicated db docker for test or using pg_temp.
Anyway thanks for reading this and feel free to provide any feedback or direction even if we have to discard everything I don't mind it will serve the adoption on sqlx in our company.
Regards
NB: we know it's not 100% releveant to sqlx, even if we think providing mock in the api could be interesting, it could be great in the end to have such "full" example in the repo for adoption/help.

Coming from a JVM stack I definetely miss the ability to mock infrastructure layer. It seems that SQLx is by design motivates only integration testing. I would love to hear feedback on this issue from the developers
fyi @launchbadge
Thank you

In the end I really managed to build a sort of structs around it, it was not easy to get it but in the end it is just perfect like anything you would have in java.
What I used a struct wrapper around the DB struct (where you attach trail/impl call to sql), this wrapper has a mirror holding mock db struct.
This wrapper must also have to be in charge of handling get_connection and everything related to a transaction.
The test wrapper has obvisouly peculiar mechanics to allow you to trigger different sql case like tx error etc, it also holds the different DB classic Mock with mockall.
Then you use #[cfg(not(test))] and #[cfg(test)] to import the right one.
It is important to notice that you just cannot have a big mock wrapper as it would be totally unusable through the testing phase as when you use Mock, they need to be immutable.
Major point is that you can find there and there valid solutions up until you need to use transaction (with commit and rollback), meaning, the struct that is doing sql have an extra parameter which is a connection or a transaction connection.
Then, the issue appears outside the db component where you have the tx alongside classic other component, it will just still require a DB connection.
Having this now for more than 2 years in place in all our sqlx rust backends.

In the end I really managed to build a sort of structs around it, it was not easy to get it but in the end it is just perfect like anything you would have in java.
What I used a struct wrapper around the DB struct (where you attach trail/impl call to sql), this wrapper has a mirror holding mock db struct. This wrapper must also have to be in charge of handling get_connection and everything related to a transaction.
The test wrapper has obvisouly peculiar mechanics to allow you to trigger different sql case like tx error etc, it also holds the different DB classic Mock with mockall.
Then you use #[cfg(not(test))] and #[cfg(test)] to import the right one.
It is important to notice that you just cannot have a big mock wrapper as it would be totally unusable through the testing phase as when you use Mock, they need to be immutable or implements Clone which destroy a mock context.
Major point is that you can find there and there valid solutions up until you need to use transaction (with commit and rollback), meaning, the struct that is doing sql have an extra parameter which is a connection or a transaction connection. Then, the issue appears outside the db component where you have the tx alongside classic other component, it will just still require a DB connection.
Having this now for more than 2 years in place in all our sqlx rust backends.
NB: if I can I will share it here later.

I am currently using SQLx in my study project. I managed to split details of working with transcations in domain code via writing some basic traits.
This implementation will allow me to write unit-tests without any pain of spinning up a test database in a container for sole purpose of testing business rules
https://github.com/ReDestroyDeR/otus-highload-social-network/blob/d30298b23c225de0b03fce812177be0501ad5edf/src/pool.rs


What conditions other an invalid value cause this to be raised?

Documentation says

Property 'target' has invalid value.

But I use OnPrem which is a valid value and get the message

App.json 'target' property must not be set to 'Internal' or 'OnPrem'.

Runtime is set to 6.0.
In general the documentation Code Analyzer rules is woefully vague, can this be improved.

Document Details
⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

ID: 229e667b-0dcb-73b2-1311-baaaadd53d07
Version Independent ID: ecb669bd-c320-c245-3e3a-07cab7caf2e8
Content: Property 'target' has invalid value. - Business Central
Content Source: dev-itpro/developer/analyzers/pertenantextensioncop-pte0005-manifesttargetmustnotbeinternal.md
Service: dynamics365-business-central
GitHub Login: @SusanneWindfeldPedersen
Microsoft Alias: solsen

Thanks for the feedback. I am not sure what is causing this, because for runtime 6.0 - the value OnPrem should be perfectly valid. The message that you get doesn't use double-quotes, which is the right syntax - like this "target": "OnPrem", but compilation would catch that first. Other issues might be that the app doesn't publish to a local host, or that some other setting is contradictory to the OnPrem setting in the app.json file. Unless such a setting is causing the analyzer rule, I have to suggest that you contact support to get help on other factors which might cause this error. Thanks.

Closing this topic