-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: avoid immediate computing with
storeToRefs
Fix #2812
- Loading branch information
Showing
2 changed files
with
28 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
67d3109
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@posva, I think this commit has caused an error when
value
is null:67d3109
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@norwd #2848 (comment)
67d3109
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This breaks typescript code like this, that have worked before:
(Broke our app when bumped to 2.2.8)
I guess
if(value && value.effect)
would fix it.67d3109
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@tvartom You do need to declare all state properties. They can start as
undefined
but cannot be omitted. Addinguser: undefined
anduser: string | undefined
(in the type) is the right approach in your case 👍67d3109
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@posva, Thank you for linking to #2848, that's cleared up how we can mitigate the issue. However, this has caused a massive disruption to our system as it is a breaking change in behaviour. I agree with @tvartom and @Jv-Juven, this should be fixed to restore the previous behaviour.
67d3109
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is very important destructive behavior and this should be fixed to revert to the previous behavior @posva
67d3109
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let breakpointDecoration: EditorType.IEditorDecorationsCollection | undefined;
let breakpointHitDecoration: EditorType.IEditorDecorationsCollection | undefined;
Sometimes you need to store data that is not a ref
67d3109
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This also somehow breaks the tests in our code.
The element in the the store looks like this:
const selectedLink: Ref<Link | undefined> = ref<Link | undefined>(undefined);
In the code it is referenced as follows:
const { selectedLink } = storeToRefs(linkStore);
In the testsetup I initialize the store like this:
createTestingPinia({ initialState: { links: { selectedLink: { ...getDefaultLink(), }, })
After Updating the Version to 2.2.8, the test fails with the following error:
Cannot read properties of undefined (reading 'effect')