question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Rename `context` to `stuff`

See original GitHub issue

There are a couple different places we use the word context

  • load has a context parameter
  • getContext sets request.context

Adding this here to track and have a discussion at some point since a couple maintainers have mentioned this as being something we might want to considers

Also, it looks like perhaps we should fix this TODO in the process: https://github.com/sveltejs/kit/blob/08ebcb518c71cd58f4717784a5144cb195b49a68/packages/kit/src/runtime/server/page/respond.js#L178

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:6
  • Comments:27 (21 by maintainers)

github_iconTop GitHub Comments

5reactions
dummdidummcommented, May 3, 2021

Since context just fits best if it wasn’t taken already, I propose layoutContext or loadContext to show a) the semantic similarity to contexts but b) make it visible that this is different and belongs to a specific part. The drawback of a few more keystrokes is a hit I’ll gladly take.

2reactions
Rich-Harriscommented, May 1, 2021

The core team just had a long conversation about this and we like request.locals instead of request.context. Rather than having a getLocals(request) function we can do request.locals = {} before we pass it into handle:

function handle({ request, render }) {
  request.locals.user = get_user(request);
  return render(request);
}

function getSession(request) {
  return {
    user: sanitize_user(request.locals.user)
  };
}

We also spent entirely too long trying to come up with an alternative to layout context, but couldn’t come to agreement. Some ideas that were floated, in no particular order of terribleness:

  • inherit
  • inherits
  • inherited
  • pipe
  • chain
  • context (keep as is)
  • locals (again)
  • tunnel
  • metadata
  • env
  • scene
  • domain
  • foo
  • $layout
Read more comments on GitHub >

github_iconTop Results From Across the Web

Implementing "Rename" from a ContextMenu - Stack Overflow
To clarify, what I see is funky is using IsEditable state in the setter of the Name. I think if you remove IsEditabe...
Read more >
Renaming a file, using context menu "...rename" leads to loss ...
Use the context menu "...rename" option to rename it to whatever you want. Commit these changes. What is the expected output? What do...
Read more >
Possible to "Rename" items in Context Menu? - Seven Forums
You can rename context menu entries manually, and there is info here on the forum on how to do it, but this tool...
Read more >
Quickly Rename Windows Files with a Keyboard Shortcut
In Windows when you select a file and press the F2 key you can instantly rename the file without having to go through...
Read more >
6 Ways to Rename Your Files in Windows 11 - MakeUseOf
The redesigned context menu looks a bit different in Windows 11. However, it retains the same crucial file operation options for copying, moving ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found