Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix public link preview #9009

Merged
merged 4 commits into from May 30, 2023
Merged

Fix public link preview #9009

merged 4 commits into from May 30, 2023

Conversation

kulmann
Copy link
Member

@kulmann kulmann commented May 10, 2023

Description

Right sidebar / single file resource details file preview was not working at all in public links.

Types of changes

  • 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 change)
  • Technical debt
  • Tests

Checklist:

  • Code changes
  • Unit tests added
  • Acceptance tests added
  • Documentation ticket raised:

@update-docs
Copy link

update-docs bot commented May 10, 2023

Thanks for opening this pull request! The maintainers of this repository would appreciate it if you would create a changelog item based on your changes.

@kulmann kulmann changed the base branch from master to stable-7.0 May 11, 2023 13:58
@kulmann kulmann self-assigned this May 30, 2023
@@ -23,7 +23,7 @@ export default defineComponent({
},
setup() {
const resource = inject<Resource>('resource')
const space = inject<SpaceResource>('space')
const space = inject<Ref<SpaceResource>>('space')
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

here the injected space was correctly used (with unref) but the type was wrong.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you fix the type for resource one line above as well while you're at it (same in FileDetails.vue)? 🙂

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Funny enough, the resource is provided as Resource, not as Ref. I don't know why we do that... but at least the type here is correct.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

preview.value = yield previewService.loadPreview({
space,
space: unref(space),
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line is the actual fix in this PR. The space is provided by the sidebar as computed, but we were not accessing the value but the ref itself.

@kulmann kulmann marked this pull request as ready for review May 30, 2023 10:16
@@ -23,7 +23,7 @@ export default defineComponent({
},
setup() {
const resource = inject<Resource>('resource')
const space = inject<SpaceResource>('space')
const space = inject<Ref<SpaceResource>>('space')
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you fix the type for resource one line above as well while you're at it (same in FileDetails.vue)? 🙂

@sonarcloud
Copy link

sonarcloud bot commented May 30, 2023

SonarCloud Quality Gate failed.    Quality Gate failed

Bug C 1 Bug
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

83.3% 83.3% Coverage
0.0% 0.0% Duplication

Copy link
Contributor

@lookacat lookacat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One small improvement idea, otherwise LGTM 👍🏼

resource,
dimensions: ImageDimension.Preview
})
}).restartable()
const isPreviewLoading = computed(() => {
if (unref(isFolder)) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can be reduced into one return statement, but im fine with this too

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

noo I like the easier readability this way

@kulmann kulmann merged commit 138dca7 into stable-7.0 May 30, 2023
3 of 4 checks passed
@delete-merged-branch delete-merged-branch bot deleted the fix-public-link-preview branch May 30, 2023 12:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants