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

Version 3.0.0 breaks on Studio refresh, also prevents applying Presentation, also still uses out-of-date Studio in apps #154

Closed
narration-sd opened this issue Mar 14, 2024 · 9 comments

Comments

@narration-sd
Copy link
Contributor

narration-sd commented Mar 14, 2024

There are two direct error facets here, which I suspect are rather related, as both seem to have to do with Studio's operations with paths.

  • though the Studio appears to operate at basis with this release, it fails immediately with 404 Page not ffound, when doing a browser page refresh -- even for its entry page, at present /admin/desk with the default configuration.

  • on first attempted employment with the sanity-astro-presentation package, operating in alpha as it has very reliably for months while using the 2.x @sanity/astro package, Presentation fails entirely, indicating path problems in several ways besides the above.

To Reproduce

  1. Just bring up the apps/example project in the 3.0.0 repo, having built the encorporated package, assuring it operates. Then if you don't have Studio permission to its default project, reconfigure to a project where you can, potentially duplicating the dataset, or as I did, importing schemas and a simple page to work with your own.

  2. Once the site is up, go to the Studio at /admin by default, and note the Studio apparently operating. You can try entering pages there, but the problem will show even on the entry page, which show the replaced url /admin/desk.

  3. Then refresh the Studio's browser page. You will get a 404 Page not found, regardless which Studio page you do it from. That's the entry point to errors here, and solving it may solve others.

Expected behavior

Expected behavior would be to show the current Studio page again, without issues.

Further issues

  1. This initial 3.0.0 is continuing to use the Desk implementation of Studio, but this is now well out-of-date, so it's suggested this be updated to the Structure Studio version. Astro has just as much need as any to stay current, and Structure is used in the Presentation ability that's coming.

    I did in fact quickly convert a copy of the apps/example to Structure; it operated with nothing added to the errors reported for Desk.

  2. As indicated from initial trials, this 3.0.0 version will fail entirely to allow Presentation, in the Sanity Astro Presentation which has been using variants of the 2.x versions very reliably. The failures all take the form of not responding to or using Url paths correctly.

    • My thought is to see the basis issue repaired, and try again, which I will do rapidly on given access, or could for intermediate trials on a road to full repair..

    • If we come to need for it, there is an alpha release of the Astro Presentation capabilities operating, including loadable data for using its demonstrations, where access could be provided to work out any further issues should they appear.

Which versions of Sanity are you using?

$ sanity versions
@sanity/cli (global) 3.34.0 (up to date)
@sanity/astro 3.0.0 (up to date)
@sanity/image-url 1.0.2 (up to date)
@sanity/vision 3.19.0 (latest: 3.34.0)

What operating system are you using?
Windows 11 very latest, well maintained

Which versions of Node.js / npm are you running?

$ npm -v && node -v
10.2.4
v20.11.1

Security issue?

No security issues

@narration-sd narration-sd changed the title Version 3.0.0 breaks on Studio refresh, also prevents applying Presentation, also still uses the out-of-date Version 3.0.0 breaks on Studio refresh, also prevents applying Presentation, also still uses out-of-date Studio in apps Mar 14, 2024
@narration-sd
Copy link
Contributor Author

narration-sd commented Mar 16, 2024

[ n.b. While what follows covers the proved solution and aspects to implementing for issues raised here, I'd like to smile and invite to skip over it, to read the little story below first, as it could cut the need to do most of what is here. ]

The issues raised above are resolved, in working devs and sites, with ordinary Studio operation returned, including also full and quite nice operation of Presentation. That part's been helped along by some of its fixes coming through at end of this week -- kudos and thank you, to the attentive team.

The Presentation portion boils down to needing to continue to operate in hybrid server mode, while depending on careful workarounds for the issues raised by making ordinary Studio possible without hybrid.

  1. The 'small change' on this pull is essential, and matches with needing to use hybrid mode for Presentation -- everything has to be live, and together. Otherwise, you get detached and non-functional windows, with paths they aren't following, instead of the smooth Sanity Studio pane transitions expected..

  2. Equally needed is a server configurations that package users will need to understand clearly in order to make them, for any of their environments, so that Studio -- and only Studio -- has its own unique 'missing page' redirect. This is not comfortable, but may not be avoidable with the 'sometimes-can-be-static Studio' change.

For this second point, I've provided a working example tried out for Netlify, and others like it will need to be explained with example, for each platform to use the new release of this package. It's yet to be documented.

The second point is also a requirement for ordinary Studio operation on the new package, as otherwise a simple browser page refresh will result in a blank 404 instead of a fresh view, as has already been noted by persons with careful intents.

The workaround for that does put you back on the correct Studio page that had been open, even though it would appear not to; this is no doubt due to state that the Studio keeps to assure this.

I know I've been long-winded here, but there are a lot of moving parts, for such a simple-seeming package, and it seems worthwhile to note those turning up as important ones here -- beyond that, apologies.....

@narration-sd
Copy link
Contributor Author

narration-sd commented Mar 16, 2024

Well, some time away and after the work today, and writing it up here, it seems I should say what I've been thinking -- that it would be both the kindest and the most useful, as I think it's the more accurate picture....

In software, there's often a tendency to do something, isn't there, when you see it can give a little enjoyment, a feeling of being 'neat', or another even better and conversational word one of my Norwegian uncles loved to use, with his very accurate English. But often enough what can feel clever isn't quite the most practical, and can make over-riding requirements, particularly on persons using it, isn't it also so....

I'm afraid this is how I found I was feeling about the added feature in this release, which arranges that the Studio can be provided, in some cases, without using an Astro hybrid adapter. Sounds good....maybe...and if there's some suggesting reason I may not be aware of, but it shows to have a daunting downside, that as described above, we have to assure that every designer to use it adds a tricky selective redirect to their overall web system, or run into trouble with the Studio.

They'd need to understand well enough to do this while remaining accurate to that system, with the care not to interfere with other functions its own redirects have, usually assumed as automatic and used for business purpose, not just technical handling.

And if you don't get it right, on the Sanity side the result will be quite off-putting, things persons really don't want to see. Page refreshes that send users to 404, link actions that, instead of expected transitions, open non-functional extra windows which can't obey the complicated URLs they show. I was reckoning myself, that something deep in Sanity's design had been disturbed, if now well understanding how those results could come from something much more light weight in itself and external.

I just don't feel we want to have these things happen to people, especially those who are drawn to Astro for its promise of easy, efficient constructions arranged around Sanity's abilities. And especially not in the way these problems act, which multiplies in seriousness when the fine privilege of Presentation is added to their offering.

Without leaning on that, isn't it just a question of worth? What and for whom would 'sometimes no hybrid' buy -- vs. having an easy to establish and maintain system, which feels entirely reliable?

So I'd like to suggest we nod quite respectfully towards person or person who invented this...and not use it, remove the temptation from this package which without it is the strong foundation to all the easy entries we can offer to persons who will enjoy Astro and Sanity's benefits together.

I suspect there would be a rather profound feeling of relief, and opening to possibilities, in this - for one person's opinion anyway, after seeing the alternative :)


Coming back to this even a bit later, of course it's possible that there's a request or reason for the addition that I haven't been aware of, so it's now mentioned above.

If that's so, then maybe a good answer would be to have two versions of sanity-astro. For the many, simply using Astro's installer for an adapter, and setting it to hybrid, would surely be more easy and acceptable, than being required to work out and assure a special redirect that must fully not disturb the rest of their site.

Missed links are, after all, a marketing opportunity for many sites, and their responses wouldn't like being disturbed.

In any case, my intent has surely not been to come on too strongly; just to offer from a sense of judgement that was speaking, built up over experience.

I'll hope that can be helpful here.

@juice49
Copy link

juice49 commented Mar 28, 2024

Hey there! Thank you for your feedback. We're working on a fix for the 404 issue that we hope to release soon. In the meantime, is it viable for you to use version 2.2.1?

@narration-sd
Copy link
Contributor Author

hello - yes, of course, thanks. I pin 2.21 and recommend it to others.

Interested in what you may come up with here -- maybe that will change the feeling it's one of those reaches afar of a justification?

And as mentioned, where I really need this package, must run in hybrid anyway....

@christianhg
Copy link
Contributor

Hi there!

I'm pretty sure all the issues outlined here are more-or-less resolved by now.

  1. The 404/refresh issue has been fixed
  2. The internal version of sanity is updated so the studio should be up-to-date
  3. Presentation should be available as well
  4. We even expose a new VisualEditing if you are interested in venturing into visual editing in Astro: https://github.com/sanity-io/sanity-astro?tab=readme-ov-file#enabling-visual-editing (more docs are coming)

Could you update your @sanity/astro dependency and check if the above meets your expectations?

@narration-sd
Copy link
Contributor Author

Hello Christian, thanks for letting me know -- and I'll be happy to have a look at this, on several counts, certainly.

Appreciated,
Clive

@narration-sd
Copy link
Contributor Author

narration-sd commented May 24, 2024

@christianhg Christian, I'm a bit exhausted after a long day with this, but I want to say that it feels you, and anyone working with you on this, have done very good work.

  • On your short list above, everything is indeed operating, and I haven't seen any more direct issues at this point.

  • on Presentation itself, what you have here works very well indeed, for its simplicity.

    • I've brought up a straightforward blog, locally in dev and then deployed with its Studio on Vercel, implemented with several types of components.

    • Visual Editing operates very reasonably. It's not as snappy as my sanity-astro-presentation method, but for personal site purposes at the least, it's likely to be quite usable. Portable Text and an Image edit on a detail level well.

    • I was able to do this only because of my background by now with the Sanity abilities -- none of this is going to show with the examples, not even the Studio I think. But this is something to be worked up now that you have the platform 'going', not so?

    • I'll make some notes later on what it takes to get for example an image to visually edit, which should be a good pattern for any other items which aren't automatic.

    Ok. (!) I'll have to break off now, but I'd like you to iknow this will be getting a good look for how it may [pssob;u help out the college website project I'm consulting on -- there's a possibility it could be surprising. I'm not sure how well this approach will work with the very complicated, netsted, and sizeable schemas, portable texts, and loaded-up pages, but we'll have a look, and find out.

    I think you know the main advantage of this system - that it gives Presentation using only Astro code. How far that possibility works in terms of page update speeds with built-up component complication will be interesting to find out, but I think already tthat what you have is sure to find good use for a number of persons.

The last point is a very nice one to discover, I think, even though it highlights a problem.

It is that in your framework, which has almost nothing in common with mine, I find exactly the same issue I've given a detailed report on, in visual-editing.

So we can be confident now, I think, that it will appear in any Presentation system, and so will get its due attention, so that Sanity's accomplishments become even smoother.

Again, Christian, this is good work. I'll look at it further on the points which were of interst before, for ease-of-use by 'normal persons', those who want to build things with Astro, and that opportunity for Sanity. I suspect today, though, that you and any persons working with you have quite helped open that door.

Best,
Clive

p.s. a little extra kudos, you can find here on the Sanity Slack; maybe something useful also to come

@narration-sd
Copy link
Contributor Author

should close this, I think, but we can continue to converse, as may have things to offer....

Cheers, Christian...

@narration-sd
Copy link
Contributor Author

narration-sd commented May 25, 2024

@christianhg Christian, I've just put up a fully Presentation blog addition, on a fork so it can be used when appropriate -- at the least, there are some things I'd like to improve in detail features, but it is working very nicely indeed with your code :)

You can find it here, the branch on the fork, may find use of the Readme inside it, and if you like, I've put an availability notice on the #astro at Sanity Discord.

But on this weekend, family time it definitely is :)

Take care,
Clive

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 27, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants